javascriptinternet-explorerversion-detection

Get browser version of IE using Javascript


I am using the following code to get the version of IE in a system.

    var browser = navigator.appName;
    var b_version = navigator.appVersion;
    var version = parseFloat(b_version);
    alert(version);

But the version always get is 4 in IE^ and IE7. How can I get the exact version?


Solution

  • It's generally not a good idea to use version detection — in fact, even browser detection isn't recommended! Instead, try object detection.