Skip to content

Instantly share code, notes, and snippets.

@handleman
Created October 14, 2014 15:01
Show Gist options
  • Save handleman/3c99e754065f647b082f to your computer and use it in GitHub Desktop.
Save handleman/3c99e754065f647b082f to your computer and use it in GitHub Desktop.
Best way to detect Mac OS X or Windows computers with JavaScript or jQuery
var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0;
var isMacLike = navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i)?true:false;
var isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i)?true:false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment