Last active
December 31, 2015 02:39
-
-
Save jkfzero/7922445 to your computer and use it in GitHub Desktop.
Get browsers name and version. Modified from jquery-migrate.
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
| var ua = navigator.userAgent.toLowerCase(); | |
| var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || | |
| /(webkit)[ \/]([\w.]+)/.exec(ua) || | |
| /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || | |
| /(msie) ([\w.]+)/.exec(ua) || | |
| ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; | |
| var browser = match[1] || ""; | |
| var version = match[2] || "0"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment