var onenetHelperInit = new Object(); var oneNetHelper; onenetHelperInit.Init = function () { var IsIE = (!!window.ActiveXObject || "ActiveXObject" in window) ? true : false; if (IsIE){ oneNetHelper = oneNetHelper_activex; } else { var brs = getBrowserType(); if (brs == "qax" || brs == "uos") { oneNetHelper = oneNetHelper_np; } else if (brs == "chrome") { if (isLinux()) { oneNetHelper = oneNetHelper_np; } else { oneNetHelper = oneNetHelper_webext; } } else { oneNetHelper = oneNetHelper_webext; } } } /*** * 获取当前浏览器类型 */ function getBrowserType() { var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var isOpera = userAgent.indexOf("Opera") > -1; if (isOpera) { //判断是否Opera浏览器 return "opera"; } if (userAgent.indexOf("Firefox/31") > -1) { //判断是否Firefox浏览器 return "uos"; } if (userAgent.indexOf("Firefox") > -1) { //判断是否Firefox浏览器 return "firefox"; } if (userAgent.indexOf("Chrome") > -1) { var bsrt = getShellerType(); if (bsrt == "") { return "chrome"; } else { return bsrt; } } if (userAgent.indexOf("Safari") > -1) { //判断是否Safari浏览器 return "safari"; } if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) { //判断是否IE浏览器 return "ie"; } return ""; } function getShellerType() { var brwType = "", userAgent = window.navigator.userAgent, external = window.external; if(external && 'SEVersion' in external) { // 搜狗浏览器 brwType = 'sougou'; } else if(external && 'LiebaoGetVersion' in external) { // 猎豹浏览器 brwType = 'liebao'; } else if(/QQBrowser/.test(userAgent)) { //qq浏览器 brwType = 'qq'; } else if(/Maxthon/.test(userAgent)) { //遨游浏览器 brwType = 'maxthon'; } else if(/TaoBrowser/.test(userAgent)) { //淘宝浏览器 brwType = 'taobao'; } else if(/BIDUBrowser/.test(userAgent)) { //百度浏览器 brwType = 'baidu'; } else if(/UBrowser/.test(userAgent)) { //UC浏览器 brwType = 'uc'; } else if(/Qaxbrowser/.test(userAgent)) { //奇安信浏览器 brwType = 'qax'; } else if(/UOS/.test(userAgent)) { //uos浏览器 brwType = 'uos'; } return brwType; } function isLinux() { var userAgent = navigator.userAgent; if(userAgent.indexOf('Linux') > -1) { return true; } return false; }