Skip to content

Instantly share code, notes, and snippets.

@thisiskylierose
Forked from stugoo/modernizr-ios6-test.js
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisiskylierose/2155d2a1dc4578573579 to your computer and use it in GitHub Desktop.
Save thisiskylierose/2155d2a1dc4578573579 to your computer and use it in GitHub Desktop.
// i know, i know, browser sniffing :(
// adaptation of http://stackoverflow.com/questions/8348139/detect-ios-version-less-than-5-with-javascript
Modernizr.addTest('ios6', function() {
var ios6 = false,
v, ver = false;
if (/iP(hone|od|ad)/.test(navigator.platform)) {
v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/),
ver = parseInt(v[1], 10),
ios6 = (ver <= 6);
}
return ios6;
});
//usage
/*
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
.ios6 .thing {
background: red;
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment