Created
September 19, 2016 11:56
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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