Js check version Internet Explorer. After browser update, old code check version is not apply in jQuery or Javasccript. Because, I was search and see a result is good. I’m using to projects in company and this is perfect.
This is new code check version of Internet Explorer:
/* check version ie9+ */ if (navigator.appName == "Microsoft Internet Explorer") { ie = true; //Create a user agent var var ua = navigator.userAgent; //Write a new regEx to find the version number var re = new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"); //If the regEx through the userAgent is not null if (re.exec(ua) != null) { //Set the IE version ieVersion = parseInt(RegExp.$1); if(ieVersion == 8){ //action with ie 8 } if(ieVersion == 9){ //action with ie 9 } if(ieVersion == 10){ //action with ie 10 } } } else { if (navigator.appName == 'Netscape') { ie = true; var ua = navigator.userAgent; var re = new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})"); if (re.exec(ua) != null) { ieVersion = parseInt( RegExp.$1 ); if(ieVersion == 11){ //action with ie 11 } } } }
Check browser in Internet Explorer 11
Note: check in Internet Explorer browser is difference between version 8, 9, 10 and version 11.
Because code exist 2 case check for 2 this difference.
Have a good day. Thank for watching!