Javascript Redirect
This is a Javascript Redirect with a delay of 3 seconds
<script type="text/javascript">
<!--
setTimeout('window.location="http://www.google.com"', 3000);
//-->
</script>
This is valid XHTML and you need to put this code in between the <head> and </head> tags of your page. The 3000 means the page will redirect in 3000 milliseconds–or 3 seconds, change it to be what you want.
Do you want an instantaneous redirect? Here’s the code (same rules apply as above):
<script type="text/javascript">
<!--
window.location="http://www.google.com"';
//-->
</script>
The address can be relative or absolute. People may have Javascript turned off, so I find a PHP redirect much better.
[...] redirects are better than Javascript redirects because it is done server side and there is no possibility of the user having JS turned off and not [...]
Oops, that doesn’t work! You need to the line to read “window.location.href” instead.
Post a Comment »
Comment Guidelines