Js judges the browser type and version, and js judges the browser
Function CheckBrowser () {ua = navigator. userAgent; ua = ua. toLocaleLowerCase (); var browserVersion; if (ua. match (/msie /)! = Null | ua. match (/trident /)! = Null) {browserType = "IE"; // Haha, now you can check ie11.0! BrowserVersion = ua. match (/msie ([\ d.] + )/)! = Null? Ua. match (/msie ([\ d.] +)/) [1]: ua. match (/rv :( [\ d.] +)/) [1];} else if (ua. match (/firefox /)! = Null) {browserType = "Firefox";} else if (ua. match (/opera /)! = Null) {browserType = "ou peng";} else if (ua. match (/chrome /)! = Null) {browserType = "google";} else if (ua. match (/safari /)! = Null) {browserType = "Safari";} var arr = new Array (browserType, browserVersion); return arr ;}
<Pre name = "code" class = "javascript"> welcome to the software exchange group: 398918539
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.