Skip to content

Instantly share code, notes, and snippets.

@superfine
Created September 19, 2016 11:56
Show Gist options
  • Save superfine/9a6268f4126334b209904d3641f836c8 to your computer and use it in GitHub Desktop.
Save superfine/9a6268f4126334b209904d3641f836c8 to your computer and use it in GitHub Desktop.
How to determine browser version from scripthttp://stackoverflow.com/questions/19999388/check-if-user-is-using-ie-with-jquery
'use strict';
var §projectName§ = window.§projectName§ || {};
§projectName§.msieversion = {
init: function() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number
{
console.log(parseInt(ua.substring(msie + 5, ua.indexOf('.', msie))));
} else // If another browser, return 0
{
console.log('otherbrowser');
}
return false;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment