Forum Moderators: open
WikiMedia does something that works well. [meta.wikimedia.org]
ASP in page its own page, i.e. redirectpage.asp:
<head>
<%
If Request.Querystring("url") <> "" Then
xsite= Request.Querystring("url")
Else
'specify a default page to redirect to
xsite="http://www.yourdomain.com/"
End If
%>
<meta http-equiv="refresh" content="5;Url=<%=xsite%>">
</head>
<body>
<p>You are leaving our web sitep>
<p>If you want to continue visiting our site, <a href="javascript:history.back()">CLICK HERE</a>.</p>
<p>Otherwise you will be redirect to you destination in 5 seconds or you may <a href="<%=xsite%>">CLICK HERE</a> to continue.</p>
<p>Thank you for visiting. Please visit us again soon!</p>
<!-- Below is optional from here -->
<p>You visited us on </p>
<p><%
response.write(FormatDateTime(date(),vblongdate))
response.write(" at ")
response.write(FormatDateTime(now(),vblongtime))
response.write(".")
<!-- to here -->
%>
</p>
</body>
Link in page you are leaving:
<a href="redirectpage.asp?url=http://www.newdestination . com">Link</a>
(Note, I put a space on either side of the period so it would not create an actual link.) This works really well and I would assume there is a php version.
Marshall
In this case, using Javascript will not be possible because the .gov sites also require that functionality is NOT Javascript-dependent (accessibility guidelines,) in which case you need to have the link point to an intermediary server-side script, such as marshall's example. PERL works too! :-)
framespage.html?url=http://example.com/ Then, display the top frame at 100px height, fixed, with your logo and some text explaining that the page below is not yours, etc.
The remaining space should be one large frame which contains the URL you sent through.
You could just use a dynamic framespage... all links go to framespage.html?url=http://example.com/
I do the exact same thing on a particular site and it was wokring well until I changed hosts. The same (simple) script works fine on another host also. But on the new host I'm getting the following error returned:
406 Not AcceptableAn appropriate representation of the requested resource /framed.php could not be found on this server.
It doesn't matter what URL I pass. It doesn't matter whether the parameter is urlencode'd. Everthing validates. If I instead hard-code the passed parameter (and not actually pass it) it works fine - the resulting framed page in itself is OK. (?!)
I'm not sure what is going on (I'm guessing some added security on the server?!), but my workaround is to not pass the "http://" part of the URL, but instead append this to the URL in the script, and this works OK!
...just in case anyone has the same issue trying this method!
Rather than pass a relative URL (as mentioned above), simply using a parameter name other than 'site' solves this problem. So using
?url=http://example.comas in vincevincevince's example should be OK.