How can I detect macOS command keys in JavaScript

Raja

How can I know macOS command keys in JavaScript.

Need to know left and right command keys. I know key codes of these both but I don't know how to separate from other keys.

GibboK

You could look on keydown/keyup and record when a key is pressed based on event.keyCode.

Or as Alexander pointed out, you can also use:

event.metaKey https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/metaKey

There are some libraries which can help you out as these keys are browser dependent

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to detect arrow keys in a Javascript game?

分類Dev

How can I detect and parse from one of these string formats in JavaScript?

分類Dev

Swift, macos - Can I detect or make other app to be in the foreground?

分類Dev

How can I detect a hidden Desktop?

分類Dev

How can I detect embeds in a message?

分類Dev

How can I get an javascript error's prototype member object keys?

分類Dev

How can I detect how many capture groups are in a Perl Regexp?

分類Dev

How I can use a DataObject on MacOS (Drag and Drop files)

分類Dev

MacOS: How can I activate fonts programmatically, systemwide?

分類Dev

How can I get colors to show up in terminal (macOS Sierra)

分類Dev

Detect whether macOS app was launched from the command line (Terminal)

分類Dev

How can a JavaScript app detect if a Leap Motion device is connected

分類Dev

How can I save the last command to a file?

分類Dev

How can I get the source code of a command?

分類Dev

How can I make Github desktop detect changes in STS?

分類Dev

How can I detect a tap event in a child class of UIView?

分類Dev

How can I detect if a label has a specific class?

分類Dev

How can I detect where the text baseline is positioned

分類Dev

How can I detect extension or shrinkage on window resize?

分類Dev

How do I detect, with JavaScript, if an image was pasted or dropped into a contenteditable area?

分類Dev

How can I return common values of dictionary values for specific keys?

分類Dev

How can I combine consecutive keys of an array depending on their values?

分類Dev

Given a dictionary how can I check if two of its keys are the same?

分類Dev

How can I get an index type from the keys of a typed object?

分類Dev

How can I read keys from a json variable in postgres

分類Dev

How can I remap windows and alt keys in OS X?

分類Dev

How can I change the named keys in an associative array

分類Dev

How can I allow ssh host keys to be added again?

分類Dev

How can I pass function keys to htop in a tty?

Related 関連記事

  1. 1

    How to detect arrow keys in a Javascript game?

  2. 2

    How can I detect and parse from one of these string formats in JavaScript?

  3. 3

    Swift, macos - Can I detect or make other app to be in the foreground?

  4. 4

    How can I detect a hidden Desktop?

  5. 5

    How can I detect embeds in a message?

  6. 6

    How can I get an javascript error's prototype member object keys?

  7. 7

    How can I detect how many capture groups are in a Perl Regexp?

  8. 8

    How I can use a DataObject on MacOS (Drag and Drop files)

  9. 9

    MacOS: How can I activate fonts programmatically, systemwide?

  10. 10

    How can I get colors to show up in terminal (macOS Sierra)

  11. 11

    Detect whether macOS app was launched from the command line (Terminal)

  12. 12

    How can a JavaScript app detect if a Leap Motion device is connected

  13. 13

    How can I save the last command to a file?

  14. 14

    How can I get the source code of a command?

  15. 15

    How can I make Github desktop detect changes in STS?

  16. 16

    How can I detect a tap event in a child class of UIView?

  17. 17

    How can I detect if a label has a specific class?

  18. 18

    How can I detect where the text baseline is positioned

  19. 19

    How can I detect extension or shrinkage on window resize?

  20. 20

    How do I detect, with JavaScript, if an image was pasted or dropped into a contenteditable area?

  21. 21

    How can I return common values of dictionary values for specific keys?

  22. 22

    How can I combine consecutive keys of an array depending on their values?

  23. 23

    Given a dictionary how can I check if two of its keys are the same?

  24. 24

    How can I get an index type from the keys of a typed object?

  25. 25

    How can I read keys from a json variable in postgres

  26. 26

    How can I remap windows and alt keys in OS X?

  27. 27

    How can I change the named keys in an associative array

  28. 28

    How can I allow ssh host keys to be added again?

  29. 29

    How can I pass function keys to htop in a tty?

ホットタグ

アーカイブ