handleman
10/14/2014 - 3:01 PM

Best way to detect Mac OS X or Windows computers with JavaScript or jQuery

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;