bizware
asked on
Conditional Redirection
I would like a comprehensive understanding of the conditions under which I can redirect a visitor to another page.
I am aware of unconditional redirection such as the META|REFRESH, and conditional redirection such as NO FRAMES (if visitor's browser doesn't support frames) or NO SCRIPT (if visitor's browser doesn't support Javascript).
I beleive there are ways to redirect based on other conditionals, such as browser version. Are there other conditionals, such as the visitor's domain name, on which I can base an automatic link to a designated page?
I am aware of unconditional redirection such as the META|REFRESH, and conditional redirection such as NO FRAMES (if visitor's browser doesn't support frames) or NO SCRIPT (if visitor's browser doesn't support Javascript).
I beleive there are ways to redirect based on other conditionals, such as browser version. Are there other conditionals, such as the visitor's domain name, on which I can base an automatic link to a designated page?
To redirect depending on browser:
if (navigator.appName.indexOf ("Netscape ") != -1)
location.href = "netscape.htm";
if (navigator.appName.indexOf ("Microsof t") != -1)
location.href = "ie.htm";
else
location.href = "otherbrowser.htm";
Martin
if (navigator.appName.indexOf
location.href = "netscape.htm";
if (navigator.appName.indexOf
location.href = "ie.htm";
else
location.href = "otherbrowser.htm";
Martin
Forgot to mention...the code I posted i JavaScript.
Use it like this:
<SCRIPT LANGUAGE="JavaScript">
<!--
if (navigator.appName.indexOf ("Netscape ") != -1)
location.href = "netscape.htm";
if (navigator.appName.indexOf ("Microsof t") != -1)
location.href = "ie.htm";
else
location.href = "otherbrowser.htm";
// -->
</SCRIPT>
Use it like this:
<SCRIPT LANGUAGE="JavaScript">
<!--
if (navigator.appName.indexOf
location.href = "netscape.htm";
if (navigator.appName.indexOf
location.href = "ie.htm";
else
location.href = "otherbrowser.htm";
// -->
</SCRIPT>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER