Skip to content

Instantly share code, notes, and snippets.

@himynameisdave
Created May 10, 2016 18:54
Show Gist options
  • Select an option

  • Save himynameisdave/8eaa19f61938e168f7f0e603cdf06871 to your computer and use it in GitHub Desktop.

Select an option

Save himynameisdave/8eaa19f61938e168f7f0e603cdf06871 to your computer and use it in GitHub Desktop.
UA Sniffing for MobileSafari - I did not write this
module.exports = function isMobileSafari() {
return /(iPhone|iPod|iPad).+AppleWebKit/i.test(window.navigator.userAgent) && (function() {
var iOSversion = window.navigator.userAgent.match(/OS (\d)/);
return iOSversion && iOSversion.length>1 && parseInt(iOSversion[1]) < 10;
})();
}
@himynameisdave
Copy link
Copy Markdown
Author

navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment