Web/API/Window/ondeviceorientation

From Get docs

Summary

An event handler for the deviceorientation event, which contains information about a relative device orientation change.

Syntax

window.ondeviceorientation = function(event) { ... };
window.addEventListener('deviceorientation', function(event) { ... });

Specifications

Specification Status Comment
DeviceOrientation Event Specification Editor's Draft Initial specification.

Browser compatibility

Update compatibility data on GitHub

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

Basic support

Experimental'

Chrome Full support 7

Notes'

Full support 7

Notes'

Notes' Before version 50, Chrome provided absolute values instead of relative values for this event. Developers still needing absolute values may use the ondeviceorientationabsolute event.

Edge

Full support Yes

Firefox Full support 6

Notes'

Full support 6

Notes'

Notes' Firefox 3.6, 4, and 5 supported mozOrientation instead of the standard DeviceOrientationEvent interface.

IE

?

Opera

?

Safari

?

WebView Android Full support Yes

Notes'

Full support Yes

Notes'

Notes' Before version 50, Chrome provided absolute values instead of relative values for this event. Developers still needing absolute values may use the ondeviceorientationabsolute event.

Chrome Android Full support Yes

Notes'

Full support Yes

Notes'

Notes' Before version 50, Chrome provided absolute values instead of relative values for this event. Developers still needing absolute values may use the ondeviceorientationabsolute event.

Edge Mobile

Full support Yes

Firefox Android Full support 6

Notes'

Full support 6

Notes'

Notes' Firefox 3.6, 4, and 5 supported mozOrientation instead of the standard DeviceOrientationEvent interface.

Opera Android

No support No

Safari iOS

Full support 4.2

Samsung Internet Android

?

DeviceOrientationEvent() constructor

Experimental'Non-standard'

Chrome

Full support 59

Edge

?

Firefox

?

IE

?

Opera

?

Safari

?

WebView Android

Full support 59

Chrome Android

Full support 59

Edge Mobile

?

Firefox Android

?

Opera Android

?

Safari iOS

?

Samsung Internet Android

?

absolute

Experimental'

Chrome

Full support 7

Edge

Full support Yes

Firefox

Full support 6

IE

?

Opera

?

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Edge Mobile

Full support Yes

Firefox Android

Full support 6

Opera Android

No support No

Safari iOS

Full support 4.2

Samsung Internet Android

?

alpha

Experimental'

Chrome

Full support 7

Edge

Full support Yes

Firefox

Full support 6

IE

?

Opera

?

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Edge Mobile

Full support Yes

Firefox Android

Full support 6

Opera Android

No support No

Safari iOS

Full support 4.2

Samsung Internet Android

?

beta

Experimental'

Chrome

Full support 7

Edge

Full support Yes

Firefox

Full support 6

IE

?

Opera

?

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Edge Mobile

Full support Yes

Firefox Android

Full support 6

Opera Android

No support No

Safari iOS

Full support 4.2

Samsung Internet Android

?

gamma

Experimental'

Chrome

Full support 7

Edge

Full support Yes

Firefox

Full support 6

IE

?

Opera

?

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Edge Mobile

Full support Yes

Firefox Android

Full support 6

Opera Android

No support No

Safari iOS

Full support 4.2

Samsung Internet Android

?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.'
Non-standard. Expect poor cross-browser support.
See implementation notes.'
See implementation notes.


See also