Answers for "javascript check browser is ie"

-1

javascript check if browser is ie

var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if (msie > 0) {
  // IE 10 or older => return version number
  return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
}

var ua = window.navigator.userAgent;
var trident = ua.indexOf('Trident/');
if (trident > 0) {
  // IE 11 => return version number
  var rv = ua.indexOf('rv:');
  return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
}

var ua = window.navigator.userAgent;
var edge = ua.indexOf('Edge/');
if (edge > 0) {
  // Edge (IE 12+) => return version number
  return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
}
Posted by: Guest on January-30-2020

Code answers related to "javascript check browser is ie"

Code answers related to "Javascript"

Browse Popular Code Answers by Language