English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
javascript judge current browser version and determine ie version:
<span style="font-size:18px;">For future use: </span>
<span style="font-size:18px;">1Determine ie version</span>
<pre name="code" class="javascript"><span style="font-size:18px;">//js judge Ie version function IeVesion() { var Sys = {}; var ua = navigator.userAgent.toLowerCase(); var s; (s = ua.match(/msie ([\d.]+)/)) &63; Sys.ie = s[1] : (s = ua.match(/firefox\/([\d.]+)/)) &63; Sys.firefox = s[1] : (s = ua.match(/chrome\/([\d.]+)/)) &63; Sys.chrome = s[1] : (s = ua.match(/opera.([\d.]+)/)) &63; Sys.opera = s[1] : (s = ua.match(/version\/([\d.]+.*safari/)) &63; Sys.safari = s[1]: 0; var ieversion; if (Sys.ie){ ieversion = parseInt(Sys.ie); if(ieversion<8) { alert("Dear user!\n\n The version of Internet Explorer you are currently using is:"+Sys.ie+"); setIsTextReadOnly(true); } } else if (Sys.firefox) { ieversion = Sys.firefox; //setIsTextReadOnly(true); } else if (Sys.chrome) { ieversion = Sys.chrome; } else if (Sys.opera) { ieversion = Sys.opera; } else if (Sys.safari) { ieversion = Sys.safari; } }>/span>
2Determine the type of browser
<span style="font-size:18px;"> </span>
<pre name="code" class="javascript"><span style="font-size:18px;">//JavaScript to judge the browser //Browser version judgment function getIEVersion() { var OsObject = ""; if(navigator.userAgent.indexOf("MSIE")>0) { return "MSIE"; //IE } return "Firefox"; //Firefox else if(isSafari=navigator.userAgent.indexOf("Safari")>0) { } //return "Safari"; Ipad browser else if(isCamino=navigator.userAgent.indexOf("Camino")>0){ }/)">0){ return "Gecko"; } }<//span>
Thank you for reading, hope it can help everyone, thank you everyone for your support to this site!
Statement: The content of this article is from the network, the copyright belongs to the original author, the content is contributed and uploaded by Internet users spontaneously, this website does not own the copyright, has not been edited by人工, nor does it bear relevant legal responsibility. If you find any content suspected of copyright infringement, please send an email to: notice#oldtoolbag.com (When sending an email, please replace # with @ to report abuse, and provide relevant evidence. Once verified, this site will immediately delete the content suspected of infringement.)