ctrlKey on windows = cmdKey (metaKey) on mac


This Content is from Stack Overflow. Question asked by Teodor

This might be a silly question but I haven’t found the answer so far.
The problem I’m facing is that I need the Cmd key from mac (metaKey) when is pressed to mimic the behaivour of the Ctrl key.

I need this in order to make my shortcuts run in the next way :

When on windows : Ctrl + O opens a new window

When on mac : Cmd + O opens a new window

Basically, whenever Cmd is pressed on mac, it should be interpreted as Ctrl is pressed.

I mention the fact that my shortcuts work with Ctrl both on Mac & Windows, but when I try to use the metakey it simply won’t work, and I also have a function which detects the OS, so I know if I am either on mac or windows.



This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?