PDA

View Full Version : Redirect



k0r54
03-17-2004, 03:36 PM
Hi,

how can i redirect to the last viewed page.

for example, click on a link that will take me to a page which will say
"sorry this page is underconstruction, we will redirect you to the last viewed page."

and then 4 seconds or so later it will redirect them to the page that they click the link from,

i know javascript can use
"history.go(-1);;return false" to back to the last page, but i cant seem to put it onto a auto redirect.

i need it like this and not like a URL just goin bac to that page coz i want this redirect page to be universal to use anytime on the server, without reprogramin the page link.

any help will be great thanks

Chris
03-17-2004, 04:15 PM
You could call the javascript via onload but that would happen immediately (and not 4 seconds later).

I know...

Write a javascript function that first makes an alert box (alert()) that says "Blah blah not done blah blah" then have the function do the history.go. You can then load this function "onload" in the body tag and you'll be all set.

pas
03-17-2004, 04:27 PM
setTimeout (http://www.pageresource.com/jscript/jtimeout.htm)

OrbitSystems
03-28-2004, 03:40 PM
Someone correct me if im wrong but wouldnt it be possible to use a server side language (such as PHP) to get the referrer page and insert that into a meta tag redirect?

Im thinking this would work:



<?php
$prev_url = $HTTP_REFERER;
?>
<META http-equiv="refresh" content="4;URL=<?=$prev_url?>">