Redirect to a different webpage
From CodeCodex
Contents |
[edit] Implementations
[edit] JavaScript only
This changes the current URL.
window.location="http://codecodex.com";
[edit] JavaScript in HTML
[edit] Simple redirection
This changes the URL as soon as the page is loaded.
<SCRIPT language="JavaScript"> <!-- window.location="http://codecodex.com"; //--> </SCRIPT>
[edit] Redirection based on browser type
This changes the URL as soon as the page is loaded to a browser specific page.
<SCRIPT language="JavaScript">
<!--
var browserName=navigator.appName;
if (browserName=="Netscape")
{
window.location="http://www.codecodex.com/ns.html";
}
else
{
if (browserName=="Microsoft Internet Explorer")
{
window.location="http://www.codecodex.com/ie.html";
}
else
{
window.location="http://www.codecodex.com/other.html";
}
}
//-->
</SCRIPT>

