Skip to content

Instantly share code, notes, and snippets.

@ReeMii
Created May 28, 2015 07:29
Show Gist options
  • Select an option

  • Save ReeMii/719acd9af7f8f6fbfe73 to your computer and use it in GitHub Desktop.

Select an option

Save ReeMii/719acd9af7f8f6fbfe73 to your computer and use it in GitHub Desktop.
ios detect
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);
});
if(Modernizr.ios) {
//do sth
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment