KeyboardEvent.metaKey
read-only property returning a
布尔
that indicates if the
Meta
key was pressed (
true
) 或不 (
false
) when the event occurred. Some operating systems may intercept the key so it is never detected.
注意: On Macintosh keyboards, this is the ⌘ Command key. On Windows keyboards, this is the Windows key ( ⊞ Windows ).
At least as of Firefox 48, the
⊞ Windows
key is not considered the "Meta" key.
KeyboardEvent.metaKey
is
false
当
⊞ Windows
is pressed.
var metaKeyPressed = instanceOfKeyboardEvent.metaKey
A
布尔
function ismetaKey(e) {
alert("metaKey = " + e.metaKey);
}
<button onclick="ismetaKey(event)">Click me with the meta key</button>
| 规范 | 状态 | 注释 |
|---|---|---|
|
DOM (文档对象模型) 3 级事件规范
The definition of 'KeyboardEvent.metaKey' in that specification. |
过时 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
metaKey
|
Chrome Yes | Edge 12 | Firefox Yes | IE Yes | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android Yes | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持