0 points

Test if Mac or PC with JavaScript


Tue Jun 23 2020 09:04:03 GMT+0000 (UTC)

Posted by @Amna #javascript

if (navigator.userAgent.indexOf('Mac OS X') != -1) {
} else {
content_copy Copy

User Agent testing sucks, but sometimes you need it for subtle things. In my case I was using it to adjust what I was showing for keyboard shortcut keys (Command or Control). Nothing super major.