What would be your fastest, shortest (best) way to detect browser which is IE and version less than 9 in JavaScript, without using jQuery or any add-on libraries?
In the upper corner of Internet Explorer, select the Tools button, and then select About Internet Explorer. Open Internet Explorer, at the upper right, select the Tools button, and then choose About Internet Explorer.
Internet Explorer 11 doesn't support JavaScript versions later than ES5. If you want to use the syntax and features of ECMAScript 2015 or later, or TypeScript, you have two options as described in this article. You can also combine these two techniques.
According to Wikipedia, IE8 only supports Javascript 1.5. So they are saying IE8 completely ignores Javascript versions 1.6, 1.7, 1.8 and 1.9.
As with most modern browsers, Internet Explorer supports JavaScript, which is enabled by default to allow users view dynamic interactions like display ads and animations on web pages.
Javascript
var ie = (function(){ var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while ( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); return v > 4 ? v : undef; }());
You can then do:
ie < 9
By James Panolsey from here: http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With