Solved

Stop loading page if external link redirects

Posted on 2002-06-26
6
255 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
Comment Utility
No way

You need a server process
0
 
LVL 12

Expert Comment

by:lexxwern
Comment Utility
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
Comment Utility
A cgi can request a head - if it is a 302 or such it can deny the link.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:ipis
Comment Utility
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
Comment Utility
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
Comment Utility
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
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…
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…

744 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

16 Experts available now in Live!

Get 1:1 Help Now