Monday, July 28, 2014

Test if Internet Explorer is used and get its version number

// use the class
if(Browser.Version() <8) {
 // make crazy IE shit
}

var Browser = {
    Version: function(){
        var version = 999; // we assume a sane browser
        if (navigator.appVersion.indexOf("MSIE") != -1)
            // bah, IE again, lets downgrade version number
            version = parseFloat(navigator.appVersion.split("MSIE")[1]);
        return version;
    }
}

No comments:

Post a Comment