Created
November 1, 2011 10:33
-
-
Save hasantayyar/1330276 to your computer and use it in GitHub Desktop.
javascript browser detection functions
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
// seen in pinterest bookmarklet | |
function isIE() { | |
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) | |
} | |
function isSafari() { | |
return /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) | |
} | |
function isIOS() { | |
return navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPhone/i) != null || navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPod/i) != null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment