Thanks to visit codestin.com
Credit goes to developer.mozilla.org

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

KeyboardEvent: metaKey 속성

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015년 7월⁩.

KeyboardEvent.metaKey 는 어떤 이벤트가 발생했을 때 키보드의 Meta키가 눌려 있었는지 아닌지 (true) 혹은 (false) 를 나타내는 읽기 전용 속성입니다. 일부 운영체제에서는 키를 가로채서 감지되지 않을 수 있습니다.

참고 : 매킨토시 키보드에서, 이것은 ⌘ Command 키입니다.

참고 : 파이어폭스 118 이전에서는, ⊞ Windows 키가 "Meta" 키가 아닌 "OS"키로 실행되었습니다. KeyboardEvent.metaKey⊞ Windows 키가 눌렸을 때false를 반환했습니다.

불리언 값입니다.

예제

html
<button onclick="ismetaKey(event)">meta key를 이용하여 클릭해 보세요</button>

<p id="output"></p>
js
function ismetaKey(e) {
  document.querySelector("#output").textContent =
    `metaKey pressed? ${e.metaKey}`;
}

결과

명세서

Specification
UI Events
# dom-keyboardevent-metakey

브라우저 호환성

같이 보기