In recent years, with the upgrade of operating systems and the popularization of various new technologies, abandoning low-version IE has become a trend. This is good news for front-end personnel. You don’t have to spend too much time to be compatible with low-versions. Many sites use the method of giving low-version IE prompts (well, it’s very friendly and humane) to tourists. Generally, a prompt is given on the header, and the script detection is as follows:
function getIEVersion(){ var rv = -1; // Return value assumes failure. if(navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[/.0-9]{0,})");if(re.exec(ua) != null) rv = parseFloat(RegExp.$1);}return rv;}function checkVersion() { var msg = "You're not using Internet Explorer."; var ver = getIEVersion(); if(ver > -1) { alert(ver); if(ver >= 9.0)//This is the version to be detected msg = "You're using a recent copy of Internet Explorer." else msg = "You should upgrade your copy of Internet Explorer."; } alert(msg);}The focus here is to use the navigator object of jsBOM to obtain the browser version information, and then filter out the ie information (if any), and then you can perform certain operations on the web based on the results; in terms of browser detection, you can also retrieve the information of other browsers and adjust it according to the project as needed.
The above article on JavaScript's IE version detection is the simplest method. I am sharing all the content with you. I hope you can give you a reference and I hope you can support Wulin.com more.