Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Created May 10, 2011 08:20
Show Gist options
  • Save Takazudo/964089 to your computer and use it in GitHub Desktop.
Save Takazudo/964089 to your computer and use it in GitHub Desktop.
/**
* $.ua
* iPhone, iPad, iPod detection
*/
$.ua = (function(){
var o = {};
var ua = navigator.userAgent;
$.each(['iPhone', 'iPod', 'iPad'], function(i, current){
o[current] = Boolean(ua.match(new RegExp(current, 'i')));
o.appleDevice = o.appleDevice || o[current];
});
return o;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment