Solved

Stop loading page if external link redirects

Posted on 2002-06-26
6
256 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now