JavaScript: is the user on an Apple device? 0 ▲ Blog: Expanded Universe 1 hour ago · Tech · hide Often, you should just use feature detection instead of asking this question. But if your underlying question is "does the user expect Control or Command as a modifier key?", there's currently (November 2026) no good alternative. The short answer: const isApple = /Mac|iPod|iPhone|iPad/.test(navigator.platform); const isModified = (event) => isApple ? event.metaKey : event.ctrlKey; const modifierLabel = isApple ? "⌘" : "Ctrl"; (Even then, you might just want to check either metaKey or ctrlKey, it depends. Somebody has proposed a shortcut key constant over at w3c/uievents#412, but it doesn't appear to have gained traction.) navigator.platform seems fine to use now, but has a bit of a rocky history. MDN's browser compatibility project started tracking it in April 2018, then marked it as deprecated in August 2020, then marked it as un-deprecated in March 2022, then marked it as deprecated in August 2022, then marked it as un-deprecated in August 2025. Libraries using the regex I provided… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town