PDA

View Full Version : browser detection in javascript



bob
08-18-2010, 11:38 PM
I need help writing a browser detection script in javascript

Something Similar to below, but so I can have many more browsers and the option to load indepedent html's depending on the browser, I would like the ability to add browsers such as netscape, IE, safari, firefox, opera and chrome...



<script language="JavaScript"
type="text/JavaScript">
if(navigator.appName == "WebTV")
{
window.location = "WebTVHome.html"
}
if(navigator.appName == "Netscape")
{
window.location = "NetscapeHome.html"
}
if(navigator.appName == "Microsoft Internet Explorer")
{
window.location = "ExplorerHome.html"
}
window.location == "Other.html"
</script>


Thanks Bob

splith
08-19-2010, 06:34 PM
People still use netscape?
Netscape 8 and 9 were just a rebranded, bug-fixed version of firefox.

BM-Viper
08-20-2010, 06:40 PM
You're asking about Netscape when the first thing on there is WebTV? :P

splith
08-20-2010, 10:36 PM
Haha, some people might still use windows 98 with their TV card...
Though quite how it got the internet through a TV card I shall never know.