-
-
Save thunsaker/8bc54ffe6dc7292923ab3874abafab36 to your computer and use it in GitHub Desktop.
Custom Modernizr tests that are useful.
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
/* modernizr-ios-check.js | |
* Daniel Ott (with modifications) | |
* 3 March 2011 | |
* Custom Tests using Modernizr's addTest API | |
*/ | |
/* iOS | |
* There may be times when we need a quick way to reference whether iOS is in play or not. | |
* While a primative means, will be helpful for that. | |
*/ | |
Modernizr.addTest('ipad', function () { | |
return !!navigator.userAgent.match(/iPad/i); | |
}); | |
Modernizr.addTest('iphone', function () { | |
return !!navigator.userAgent.match(/iPhone/i); | |
}); | |
Modernizr.addTest('ipod', function () { | |
return !!navigator.userAgent.match(/iPod/i); | |
}); | |
Modernizr.addTest('ios', function () { | |
return (Modernizr.ipad || Modernizr.ipod || Modernizr.iphone); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment