-1

can i use this simple script to detect IE 10 and 11

if($.browser.version == 11.0 || $.browser.version == 10.0) {

  $("body").addClass("ie");
  
 }
  • 2
    possible duplicate of [Internet Explorer 11 detection](http://stackoverflow.com/questions/21825157/internet-explorer-11-detection) – rrk Aug 13 '15 at 12:49
  • 1
    I'm glad you are. Is this a question? – evolutionxbox Aug 13 '15 at 12:49
  • 1
    http://stackoverflow.com/questions/18684099/jquery-fail-to-detect-ie-11 – rrk Aug 13 '15 at 12:50
  • 1
    [`$.browser`](http://api.jquery.com/jQuery.browser/) is removed since jQuery_1.9. – Teemu Aug 13 '15 at 12:54
  • 1
    jQuery.browser Contains flags for the useragent, read from navigator.userAgent. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead. –  Aug 13 '15 at 12:55
  • 1
    Curious why you even need this. In older versions like IE6,7,8 was understandable but not for neweer versions – charlietfl Aug 13 '15 at 12:55
  • but i am using that migrated plugin – Mangesh Shelke Aug 13 '15 at 12:56

1 Answers1

0

check this

function getInternetExplorerVersion()
{
  var rv = -1;
  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 );
  }
  else if (navigator.appName == 'Netscape')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
getInternetExplorerVersion();