|
Donations |
|
|
|
|
|
If you found this site helpful, please donate to help keep it online
Don't want to use PayPal? Try our physical address
|
|
|
Survey |
|
|
|
|
|
|
|
|
Translate |
|
|
|
|
|
|
|
|
|
|
View previous topic :: View next topic |
Author |
Message |
z12
Sergeant
Joined: Jul 17, 2002
Posts: 130
Location: USA
|
Posted: Thu Jun 10, 2004 9:33 pm Post subject: Show HTML Re-directs |
|
|
Hi all,
Here's a filter that lets you know when your being redirected to another site. I wrote this because I got tired of being redirected, especially while doing searches, to sites that I would otherwise not visit. This filter allows me to view a link to the location that I'm being redirected to so I can choose if I want to go there or not.
The filter works by checking the "Location" & "Content-Type" headers when a 302 response (actually 30*) is received. If the Location is not related to the Host & the Content-Type is html, the "Location" header is changed to point to a html file that I added to proxo's html directory. This html file uses javascript to write a link to the web site that you were being redirected to. Click the link & your on your way, otherwise, use the browsers back button.
Here's the header filter:
Code: |
In = TRUE
Out = FALSE
Key = "Location: Show HTML Redirects (in)"
Match = "\1$IHDR(Content-Type: text/html)$RESP(30*)&\w://(^\h)"
Replace = "http://local.ptron/redir.html?dest=\1"
|
Here's the HTML (save as redir.html & put in proxo's html folder:
Code: |
<html>
<head>
<title>Page Re-Direction!</title>
</head>
<body>
<h1>You are being re-directed to the following site:</h1>
<script type="text/javascript" >
var d, i;
d = String(window.location);
i = d.search(/[=]/)+1;
d = d.substr(i);
document.write('<a href="'+d+'" >'+d+'</a>');
</script>
</body>
</html>
|
This was tested using firefox & google.
I have noticed that many redirects are missing the Content-Type header, or have the wrong mime-type. In my config, I added header filters to "fix" this, you may find that you'll have to do the same.
Comments welcome,
Mike
Edit: removed space from redir.html script tag, doh
Last edited by z12 on Mon Jun 14, 2004 10:42 pm, edited 1 time in total
|
|
Back to top |
|
|
Paul
Admin
Joined: Feb 22, 2002
Posts: 5599
Location: USA
|
Posted: Thu Jun 10, 2004 9:43 pm Post subject: |
|
|
Nice!
_________________
I love my wife. |
|
Back to top |
|
|
z12
Sergeant
Joined: Jul 17, 2002
Posts: 130
Location: USA
|
Posted: Fri Jun 11, 2004 7:48 am Post subject: |
|
|
Thanks!
Mike |
|
Back to top |
|
|
k027
1st Responder
Joined: Aug 25, 2003
Posts: 1204
Location: USA
|
Posted: Mon Jun 14, 2004 12:59 pm Post subject: |
|
|
Handy little filter. Thanx for sharing! |
|
Back to top |
|
|
ProxFox
Sergeant
Joined: Nov 11, 2003
Posts: 105
Location: USA
|
Posted: Mon Jun 14, 2004 2:22 pm Post subject: is it me... |
|
|
It's blocking redirects - but it's not showing anything at all after the "following site:"... It's blank... |
|
Back to top |
|
|
z12
Sergeant
Joined: Jul 17, 2002
Posts: 130
Location: USA
|
Posted: Mon Jun 14, 2004 10:27 pm Post subject: |
|
|
Hi ProxFox,
Ok, I just tried this with IE, redir.html opened in a new window, but the link was missing. Must be some code IE doesn't like. I'll see if I can modify the script to work with both of them.
Mike
Fixed, I edited the original post. Thanks for reporting it! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
|
Powered by phpBB 2.0.8a © 2001 phpBB Group
Version 2.0.6 of PHP-Nuke Port by Tom Nitzschner © 2002 www.toms-home.com
Version 2.2 by Paul Laudanski © 2003-2004 Computer Cops
|