JavaScript判断浏览器的类型
var request = false; var btype=getinternet(); function getinternet() { if(navigator.useragent.indexof("msie")>0) { return "msie"; //ie浏览器 } if(isfirefox=navigator.useragent.indexof("firefox")>0){ return "firefox"; //firefox浏览器 } if(issafari=navigator.useragent.indexof("safari")>0) { return "safari"; //safan浏览器 } if(iscamino=navigator.useragent.indexof("camino")>0){ return "camino"; //camino浏览器 } if(ismozilla=navigator.useragent.indexof("gecko/")>0){ return "gecko"; //gecko浏览器 } } try { request = new xmlhttprequest(); } catch (trymicrosoft) { try { request = new activexobject("msxml2.xmlhttp");//支持microsoft } catch (othermicrosoft) { try { request = new activexobject("microsoft.xmlhttp");//支持非microsoft } catch (failed) { request = false; } } }