La propiedad KeyboardEvent.metaKey
es de solo lectura y regresa un valor Boolean
que indica si la tecla Meta estaba presionada (true) o no (false) cuando el evento ocurrio.
Nota: En teclados Macintosh es la tecla comando (⌘). En teclados Windows la tecla es lla tecla window (⊞).
Syntax
var metaKeyPressed = instanceOfKeyboardEvent.metaKey
Valor de retorno
Ejemplo
function goInput(e) {
// Revisa si estaba presionada la tecla meta y
if (e.metaKey) {
// realiza esto en caso de cierto
superSizeOutput(e);
} else {
//Realiz esto en caso de falso
doOutput(e);
}
}
metaKey
Contenido HTML
<div id="example" onmousedown="ismetaKey(event);">¡Presiona la tecla meta y dame click!<div>
Contenido Javascript
function ismetaKey(e){
var el=document.getElementById("example");//Toma el control del div example
var mK=e.metaKey;//Obtiene el valor de metaKey y lo almacena
el.innerHTML="¡Presiona la tecla meta y dame click!</br>metaKey:"+mK;//Muestra el valor de metaKey
}
Especificaciones
Especificación | Status | Comentario |
---|---|---|
Document Object Model (DOM) Level 3 Events Specification La definición de 'KeyboardEvent.metaKey' en esta especificación. |
Obsolete | Definición inicial |
Compatibilidad de Navegadores
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Característica | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Soporte Básico | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Característica | Firefox Mobile (Gecko) | Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Soporte Básico | ? | ? | ? | ? | ? |