internet explorer - Add class for all IE browsers -


I need to add html element to "msie" class for all MSIE browsers. Support for IE 10 and 11 Not subsonals I tried different ways but it does not work:

Try first:

  if ($ .browser.msie) {document.documentElement.className + = 'Msie'; }  

Try another:

  var doc = document.documentElement; Doc.setAttribute ('Data-UserEngent', Navigator.Uzager); If (Data-UserAgent == 'MSI') {document.documentElement.className + = 'msie'; }  "post-text" itemprop = "text"> 

This is a version, it can be used from IE 7 to IE 10 ( you can add conditional for IE6 etc. ... ), But it will not give a class to IE11:

   gt; & Lt; Html lang = "en" class = "msie" & gt; & Lt ;! [AndIf] - & gt; & Lt ;! - [If IE 8]> gt; & Lt; Html lang = "en" class = "msie" & gt; & Lt ;! [Endif] - & gt; & Lt ;! - [If IE 9] & gt; & Lt; Html lang = "en" class = "msie" & gt; & Lt ;! [Andif] - & gt; & Lt ;! - [if! IE]> & Lt; -! & Gt; & Lt; Script & gt; If (/ * @ cc_on! @ * / False) {document.documentElement.className + = 'msie';} & lt; / Script & gt; & Lt; -! & Lt; [Endif] - & gt; & Lt ;! - [if (gt IE 9) |! (IE)]> gt; & Lt ;! - & gt; & Lt; Html lang = "en" & gt; & Lt ;! - & lt ;! [Endif] - & gt;  

Comments