D
Duncan
Hi there,
I'm developing a website that is W3C standards strict and
uses XML/XSLT/XHTML etc. As such, viewers will need to be
using a newer browser to view the pages so parsers and
the like work correctly. The only three I really want to
support are Microsoft IE 6/Netscape 7.1/Opera 7. I want
the user to go to the main page if their browser is good
enough and to a page telling them to upgrade if not. I'm
trying to use either ASP or JavaScript to do this. Would
anybody happen to have code that they use to do this
hanging around? My JavaScript is really rusty and bad,
but I know I need something like the following if using
it:
<body onload="redirectme()" style="text-align:center;">
<script type="text/javascript">
function redirectme()
{
if (navigator.appVersion.indexOf("MSIE 6"))
{
window.location="index.html"
}
else
{
window.location="notcompatible.html"
}
}
</script>
</body>
Of course, I'm missing the browser type detection (
navigator.appName.indexof() ) and any support for
Netscape or Opera. My main problems that I see are (apart
from the above resulting in an infinite loop when run)
are:
1. The values for navigator.appName.indexOf()
2. The values for navigator.appVersion.indexOf()
Thanks a lot for reading this and even more for
responding!!!
-Duncan
I'm developing a website that is W3C standards strict and
uses XML/XSLT/XHTML etc. As such, viewers will need to be
using a newer browser to view the pages so parsers and
the like work correctly. The only three I really want to
support are Microsoft IE 6/Netscape 7.1/Opera 7. I want
the user to go to the main page if their browser is good
enough and to a page telling them to upgrade if not. I'm
trying to use either ASP or JavaScript to do this. Would
anybody happen to have code that they use to do this
hanging around? My JavaScript is really rusty and bad,
but I know I need something like the following if using
it:
<body onload="redirectme()" style="text-align:center;">
<script type="text/javascript">
function redirectme()
{
if (navigator.appVersion.indexOf("MSIE 6"))
{
window.location="index.html"
}
else
{
window.location="notcompatible.html"
}
}
</script>
</body>
Of course, I'm missing the browser type detection (
navigator.appName.indexof() ) and any support for
Netscape or Opera. My main problems that I see are (apart
from the above resulting in an infinite loop when run)
are:
1. The values for navigator.appName.indexOf()
2. The values for navigator.appVersion.indexOf()
Thanks a lot for reading this and even more for
responding!!!
-Duncan