Last active
August 29, 2015 14:05
-
-
Save xionglun/224387aac3f8b53ad392 to your computer and use it in GitHub Desktop.
This file contains 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
var userAgent = navigator.userAgent.toLowerCase(); | |
var browser = { | |
version: (userAgent.match(/.+(?:rv|it|ra|ie|me|on)[\/: ]([\d.]+)/) || [])[1], | |
chrome: /chrome/.test(userAgent), | |
safari: /webkit/.test(userAgent) && !/chrome/.test(userAgent ), | |
webkit: /webkit/.test(userAgent), | |
opera: /opera/.test(userAgent), | |
msie: /msie/.test(userAgent) && !/opera/.test(userAgent ), | |
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent ), | |
android: /android/.test(userAgent), | |
ios: /iphone/.test(userAgent) || /ipad/.test(userAgent) | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment