PDA

View Full Version : Browser Detection JS



megacool
January 2nd, 2001, 04:42
I was looking for a browser detection script preferrably in Javascript.. i know some in php and perl.. the script should basically redirect IE and NS to diff pages. Thanks any idea?

Mrh0ax
January 2nd, 2001, 04:47
here you go!!! :) :) :)

<html>
<head>
<script type="text/javascript" language="javascript">
window.onload = function() {
if (is.opera) window.location.replace("op.html");
else if (is.nav) window.location.replace("nn.html");
else if (is.ie) window.location.replace("ie.html");
else window.location.replace("default.html");
}
function MiniClientSniffer() {
var ua = navigator.userAgent.toLowerCase();
this.nav = (
(ua.indexOf('mozilla')!=-1)
&& ((ua.indexOf('spoofer')==-1)
&& (ua.indexOf('compatible') == -1))
);
this.ie = (ua.indexOf("msie") != -1);
this.opera = (ua.indexOf("opera") != -1);
}
var is = new MiniClientSniffer();
</script>
</head>
<body>
Loading...
</body>
</html>

megacool
January 2nd, 2001, 05:39
Thanks a lot Mr Hoax ;) for your quick reply :o) i have to make a separate splash page for Nutscrape... ;(

Mrh0ax
January 2nd, 2001, 05:46
hehe, no problem, i saw this code on the redrival.com user forum and copied it :) hope it works heh