Window: orientationchange event

The orientationchange event is fired when the orientation of the device has changed.

Bubbles No
Cancelable No
Interface Event
Event handler onorientationchange

Example

You can use the orientationchange event in an addEventListener method:

window.addEventListener("orientationchange", function(event) {
  console.log("the orientation of the device is now " + event.target.screen.orientation.angle);
});

Or use the onorientationchange event handler property:

window.onorientationchange = function(event) {
  console.log("the orientation of the device is now " + event.target.screen.orientation.angle);
};

Specifications

Specification Status
Compatibility Standard
The definition of 'orientationchange' in that specification.
Living Standard

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
orientationchange event
Deprecated
Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 44Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support
No support
No support
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.