I'm developing one-page apps. The shortcut should vary from different OSs, especially Mac OS X. Others usually combine keystroke with Ctrl, but Mac combins with Cmd.
Until now, I tried to detect whether the OS is mac or not by this code:
var bMac = navigator.appVersion.indexOf('Mac') > -1;
This code worked well. However, after updating the Chrome to the recent version (37.0.2062.94), it doesn't work anymore.
Is there anyway to detect host OS of browser in JavaScript?
I checked Google Docs in Chrome and it's shortcut worked well with Cmd in Mac and Ctrl in Window. There should be a way to detect OS in JavaScript in Chrome.
EDIT I googled and found some pages about detecting OS in javascript: