MouseEvent.metaKey is a read-only boolean. It is true when the Meta key was held for that mouse event, and false otherwise. On Mac that is usually Command (⌘); on Windows it is the Windows key (⊞).
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.metaKey. Start with this line.
JavaScript
event.metaKey
Call
What it does
event.metaKey
Primary signature.
Built into the browser. Read event.metaKey on a MouseEvent — no import required.
Library declarations
JavaScript
event.metaKey
Parameters
Parameter
Description
Mouse / pointer event
Required. Source of metaKey
Return Value
Return Value
Description
*
The current value of event.metaKey.
JavaScript Examples
Example 1 — Log metaKey on Click
MDN-style demo: print whether Meta was held when you clicked.
JavaScript
const log = document.querySelector("#log");
document.addEventListener("click", (e) => {
log.textContent = `The meta key is pressed: ${e.metaKey}`;
});
Construct the event.new MouseEvent("click", { … }) builds a synthetic click.
Set the option.metaKey: true makes the event report Meta as held.
Inspect the result.event.metaKey is true; type is "click".
Use in tests. Dispatch the event if you need listeners to run.
Compatibility
Browser Support
MouseEvent.metaKey is Baseline Widely available (MDN: since July 2015). It is a core mouse-event modifier boolean — not Deprecated, Experimental, or Non-standard.
✓ Baseline · Widely available
MouseEvent.metaKey
Reliable Meta modifier boolean — Command on Mac, Windows key on Windows (OS may intercept).
UniversalWidely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
metaKeyExcellent
Bottom line: Safe to use in all modern browsers. Pair with ctrlKey for cross-platform power-clicks, and keep a non-Meta UI fallback.
Frequently Asked Questions
It is a read-only boolean on a mouse event. true means the Meta key was held when that event fired; false means it was not. On Mac, Meta is usually Command (⌘); on Windows it is the Windows key (⊞).
No. MDN marks MouseEvent.metaKey as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
Many operating systems bind special actions to Meta (for example opening the Start menu on Windows). The OS may handle the key before your page sees it, so the property can remain false even though the key is pressed.
Pass metaKey: true in the options object: new MouseEvent("click", { metaKey: true }). The constructed event then reports event.metaKey as true.
They are different modifiers. Mac power-clicks often use Command (metaKey); Windows/Linux often use Control (ctrlKey). Checking ctrlKey || metaKey covers both platforms for many secondary-click patterns.
For everyday mouse handlers, event.metaKey is shorter and clearer. getModifierState("Meta") is useful when you already use that API for other keys; on a normal MouseEvent they usually agree.