1

I have a webapp that tells the user to copy and paste something. I want to show them the keyboard shortcut for it. How would I find out if it's
Ctrl+C and V, or
+C and V, or even something different?

yspreen
  • 1,167
  • 2
  • 12
  • 25
  • 1
    Try this https://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript – Allan Apr 27 '18 at 10:48

2 Answers2

0

I guess you will need to handle this yourself. You can get current user system like this:

var platform = window.navigator.platform;
console.log(platform);

if (platform.startsWith('Mac')) {
  console.log('use CMD + V');
} else if (platform.startsWith('Win')) {
  console.log('use CTRL + V');
} else {
  // ...
}
Martin Adámek
  • 12,431
  • 5
  • 25
  • 47
0

You could get the platform using window.navigator.platform and if the returned value contains 'mac' you can assume it is MacOS else if it contains 'win' it is windows.

JodyL
  • 164
  • 1