5+ ways to check IE version using JavaScript/jQuery

Share this article

OK, I thought I would bring together every method I know of checking the version of Internet Explorer using JavaScript and jQuery. We all love catering for IE’s needs so if anyone knows of any other ways of making the support of IE versions easier please share and i’ll include in the list. Hawt-sniff…

Basic check for IE using JavaScript

//check for IE7
if(navigator.appVersion.indexOf("MSIE 7.")!=-1)

Check for IE version Using Moderizer

Moderizer provides us with an excellent way to detect supported browser features and as you can see below it adds the version on IE.
//check for IE8 or less
if ($('html').hasClass('lt-ie8');

//example of HTML tag populated by modernizer
<html class=" lt-ie9 lt-ie8 js no-flexbox no-canvas no-canvastext no-webgl no-touch no-geolocation postmessage no-websqldatabase no-indexeddb no-hashchange no-history draganddrop no-websockets no-rgba no-hsla no-multiplebgs no-backgroundsize no-borderimage no-borderradius no-boxshadow no-textshadow no-opacity no-cssanimations no-csscolumns no-cssgradients no-cssreflections no-csstransforms no-csstransforms3d no-csstransitions fontface no-generatedcontent no-video no-audio no-localstorage no-sessionstorage no-webworkers no-applicationcache no-svg no-inlinesvg no-smil no-svgclippaths" sizset="false" sizcache032866541369794594="704 34 0">

Check for IE using jQuery < 1.9

$.browser is now deprecated
since jQuery 1.9 this method won’t work.
//check for IE8 or less
if($.browser.msie && parseFloat($.browser.version)&lt;8){//do other stuffreturn;}

CSS Conditional Injection Script

A short snippet for detecting versions of IE in JavaScript without resorting to user-agent sniffing. Cool.
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]-->',
    return v > 4 ? v : undef;
Source: https://gist.github.com/padolsey/527683

Check for IE10 using JavaScript

Browser agent sniffer.
(function() {
  "use strict";
  var tmp = (document["documentMode"] || document.attachEvent) && "ev"
       , msie = tmp 
                  && (tmp = window[tmp + "al"])
                  && tmp("/*@cc_on 1;@*/")
                  && +((/msie (d+)/i.exec(navigator.userAgent) || [])[1] || 0)
  return msie || void 0;})();

Basic HTML conditionals

The usual method you may have seen your the HTML.
<!--[if IE 7 ]> <div id="system" class="ie7"> < ![endif]-->
<!--[if IE 7]> <script type="text/javascript"> $('#system').addClass('ie7'); </script> < ![endif]-->
Please share if you know any more methods, pitfalls and other observations to help us combat IE.

Frequently Asked Questions (FAQs) about Checking Internet Explorer Version

How can I check the version of Internet Explorer on my Windows 10?

To check the version of Internet Explorer on your Windows 10, follow these steps:

1. Open Internet Explorer.
2. Click on the gear icon located at the top right corner of the browser.
3. From the drop-down menu, select “About Internet Explorer”. A pop-up window will appear showing the version of Internet Explorer you are using.

Why is it important to know the version of my Internet Explorer?

Knowing the version of your Internet Explorer is important for several reasons. Firstly, it helps you ensure that you are using the latest version, which usually has the most recent security updates and features. Secondly, some websites and applications may not function properly on older versions of Internet Explorer. Therefore, knowing your version can help troubleshoot any compatibility issues.

How often does Internet Explorer get updated?

Internet Explorer is no longer being updated by Microsoft as it has been replaced by Microsoft Edge. The last version of Internet Explorer, IE 11, will continue to receive security updates, compatibility fixes, and technical support on Windows 7, 8.1, and 10.

How can I update my Internet Explorer to the latest version?

Since Internet Explorer is no longer being updated, you cannot update it to a newer version. However, you can ensure you have the latest security updates for IE 11 by keeping your Windows operating system updated.

What is the difference between Internet Explorer and Microsoft Edge?

Microsoft Edge is the newer browser from Microsoft that replaces Internet Explorer. It offers improved speed, security, and functionality. It also supports newer types of code, making it more compatible with websites.

Can I use Internet Explorer on a Mac?

Internet Explorer is not available for Mac. Microsoft discontinued support for Internet Explorer for Mac in 2005. Mac users can use other browsers such as Safari, Chrome, or Firefox.

How can I check the version of JavaScript I’m using?

JavaScript version is determined by the browser you are using. To check the JavaScript version, you can use online tools such as JSFiddle or JavaScript Tester.

How can I check what version of jQuery is loaded?

You can check the version of jQuery loaded by typing and running the command jQuery.fn.jquery in your browser’s console.

Can I use Internet Explorer on my mobile device?

No, Internet Explorer is not available for mobile devices. You can use other browsers such as Chrome, Safari, or Firefox on your mobile device.

What should I do if a website is not displaying correctly in Internet Explorer?

If a website is not displaying correctly in Internet Explorer, it could be due to compatibility issues. You can try using Compatibility View, which is a feature in Internet Explorer that helps you view websites as if you were using an older version of the browser.

Sam DeeringSam Deering
View Author

Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form