Created
May 11, 2016 07:20
-
-
Save bradbaris/c1351bd8dce512574c2ba4561aaf7120 to your computer and use it in GitHub Desktop.
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
/** | |
* @fileoverview Utility functions related to the user agent. | |
*/ | |
function isIOS() { | |
return /iPhone|iPad|iPod/i.test(navigator.userAgent); | |
} | |
function isAndroid() { | |
return /Android/i.test(navigator.userAgent); | |
} | |
function isIE() { | |
return /MSIE\/\d+/.test(navigator.userAgent); | |
} | |
function isIEorEdge() { | |
return /Edge\/\d+/.test(navigator.userAgent) || | |
/MSIE\/\d+/.test(navigator.userAgent) || | |
/Trident\/\d+/.test(navigator.userAgent); | |
} | |
module.exports = { | |
isAndroid: isAndroid, | |
isIOS: isIOS, | |
isIE: isIE, | |
isIEorEdge: isIEorEdge | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment