首頁  >  文章  >  web前端  >  ExtJS判斷IE瀏覽器類型的方法_extjs

ExtJS判斷IE瀏覽器類型的方法_extjs

WBOY
WBOY原創
2016-05-16 17:00:551361瀏覽

代碼在ext裡的srccoreext.js下

最新的ext3.0beat1的代碼如下:

複製代碼程式碼如下:

ua = navigator.userAgent.toLowerCase(),
check = function(r){
return r.test(ua);
},
},
isStrict = document.compatMode == "CSS1Compat",
isOpera = check(/opera/),
isChrome = check(/chrome/),
isWebKit = check(/webkit/),
isSafari = !isChrome && check(/safari/),
isSafari3 = isSafari && check(/version/3/),
isSafari4 = isSafari && check(/version/4/),
is. !isOpera && check(/msie/),
isIE7 = isIE && check(/msie 7/),
isIE8 = isIE && check(/msie 8/),
isGecko = !isWebKit & checkis(WebKit & check /gecko/),
isGecko3 = isGecko && check(/rv:1.9/),
isBorderBox = isIE && !isStrict,
isWindows = check(/windows|win32/), isAir = check(/adobeair/),
isLinux = check(/linux/),
isSecure = /^https/i.test(window. location.protocol);

而2.2.1下(在sourcecoreext.js裡)的為
複製程式碼



複製程式碼



複製程式碼



複製程式碼



複製程式碼


複製程式碼複製程式碼複製碼> 程式碼如下: var ua = navigator.userAgent.toLowerCase(); var isStrict = document.compatMode == "CSS1Compat", is ("opera") > -1, isChrome = ua.indexOf("chrome") > -1, isSafari = !isChrome && (/webkit|khtml/).test(ua), isSafari3 = isSafari && ua.indexOf('webkit/5') != -1, isIE = !isOpera && ua.indexOf("msie") > -1, isIE7 = !isOpera && ua.indexOf ("msie 7") > -1, isIE8 = !isOpera && ua.indexOf("msie 8") > -1, isGecko = !isSafari && !isChrome && ua.indexOf("gecko") > -1, isGecko3 = isGecko && ua.indexOf("rv:1.9") > -1, isBorderBox = isIE && !isStrict, isWindows = (ua.indexOf("windows") ! = -1 || ua.indexOf("win32") != -1), isMac = (ua.indexOf("macintosh") != -1 || ua.indexOf("mac os x") ! = -1), isAir = (ua.indexOf("adobeair") != -1), isLinux = (ua.indexOf("linux") != -1), isSecure = window.location.href.toLowerCase().indexOf("https") === 0;
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn