Solved

Stop loading page if external link redirects

Posted on 2002-06-26
6
257 Views
Last Modified: 2012-06-21
I have many external links on my website and sometimes I find that the URL is redirected to adult sites. I want a inline script for the links on my page to check the URL of the link with the URL of the page it is trying to load and if it is not the same then stop loading it.
0
Comment
Question by:garylake
6 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 7110303
No way

You need a server process
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7110588
what sort of links are these which redirect wierdly?

if its an outside link you should complain to the people incharge.

client side definitely not possible, server side depends . . . i dont see a cgi checking file parameters on other servers.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 7110949
A cgi can request a head - if it is a 302 or such it can deny the link.
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Expert Comment

by:ipis
ID: 7112977
I fully agree with the above comments - you could "catch" a redirection BEFORE the page is loaded only on the server, but what to do if you don't have an access to the server's cgi. It is not easy, if possible at all.
Here is a (not so) simple idea that may be could stop showing of "wrong" pages in IE

1. open the pages of your site in frameset with one frame - the frameset could hold js variables to check the location of the document in the frame.

2. secure the "top" window document (the frameset) for beeing changed from the frame - use the event onbeforeunload - here is the example from MSDN :
<head>
<script>
function closeIt()
  {
    event.returnValue = "Any string value here forces a dialog box to appear before closing the window.";
  }
</SCRIPT>
</HEAD>
<BODY onbeforeunload="closeIt()">
    <a href="http://www.microsoft.com">Click here to navigate to
        www.microsoft.com</a>
</BODY>
However there is no way to prevent showing of the page if the user confirms it, but may be you could open new window with your site and close this one within the function (i am not sure if possible)

3. always change the location in the frame through functions in the frameset (top)
-"onunload" save the url of the current page and make the frame invisible (through style),
- get the url to load (with assigning of behavior to the a and form in css)
-load the requested url,
-"onload" check the real url of the loaded document
- if it is the expected make the frame visible, if not load the saved url

I have to say that I never tried this so I expect your comments and critics :)

Ivan


0
 
LVL 12

Expert Comment

by:ahosang
ID: 8286333
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 8360782
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question