Re: Auto Re-direct

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jon Spivey (js_at_roksteady.net)
Date: 03/21/04


Date: Sun, 21 Mar 2004 14:18:30 -0000

None atall

Somebody made the valid point earlier in this thread that the downside of
using the meta is it breaks the back button - ie user goes to page meta
sends him to a different page he hits back the meta kicks in again and sends
him back to the same page. Endless loop. The javascript solution this guy
posted would do exactly the same.

The javascript I posted up earlier won't break the back button - the key is
location.replace('page.htm') rather than location.href='page.htm'. We'd
still need the meta as a fall back to cover non-script users
<script type="text/javascript">
location.replace('otherpage.htm');
</script>
<noscript>
<META HTTP-EQUIV=Refresh CONTENT="0; URL=otherpage.htm">
</noscript>

Jon

Thomas A. Rowe wrote:
> What is the advantage of using this over the meta refresh?
>
>
> "Wizard" <anonymous@discussions.microsoft.com> wrote in message
> news:10d5001c40f4c$2f1bf8f0$a301280a@phx.gbl...
>> Hi
>>
>> It's very simple, use JavaScript.
>>
>> Here is an example:
>>
>> Add this between <head> and </head>:
>>
>> <SCRIPT LANGUAGE="JavaScript">
>> <!-- Begin
>> redirTime = "10000";
>> redirURL = "http://www.123.test/otherpage/";
>> function redirTimer() { self.setTimeout
>> ("self.location.href = redirURL;",redirTime); }
>> // End -->
>> </script>
>>
>> and this one to your <body>
>>
>> <body onLoad="redirTimer()">
>>
>> Number 10000 is 10 seconds.
>>
>>
>> --Wizard--
>>
>>
>>> -----Original Message-----
>>> Is there a simple script I can add to my home page to automatically
>>> (seamlessly) take the browser to another page..
>>>
>>> For example my domain www.123.test
>>>
>>> I want to automatically go to www.123.test/otherpage/
>>>
>>>
>>> I am sure this is simple to do but I don't know how to..
>>>
>>> Any assistance appreciated.
>>>
>>> John Parker
>>>
>>>
>>> .


Quantcast