Web/API/MouseEvent/getModifierState

From Get docs

The MouseEvent.getModifierState() method returns the current state of the specified modifier key: true if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, false.

See the document of KeyboardEvent.getModifierState() for details.

Syntax

var active =​ event.getModifierState(keyArg);

Returns 

A Boolean

Parameters

keyArg
A modifier key value. The value must be one of the KeyboardEvent.key values which represent modifier keys or "Accel". This is case-sensitive.

Specifications

Specification Status Comment
Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'getModifierState()' in that specification. Obsolete Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
getModifierState Chrome

Full support 47

Edge

Full support 12

Firefox

Full support Yes

IE

?

Opera

Full support Yes

Safari

?

WebView Android

Full support 47

Chrome Android

Full support 47

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support 5.0

"Accel" parameter

Deprecated'Non-standard'

Chrome

No support No

Edge

No support No

Firefox

?

IE

?

Opera

?

Safari

?

WebView Android

No support No

Chrome Android

No support No

Firefox Android

?

Opera Android

?

Safari iOS

?

Samsung Internet Android

No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.'
Deprecated. Not for use in new websites.


See also