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 abort event in an addEventListener method:

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

Or use the onorientationchange event handler property:

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

Specifications

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

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox 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 YesEdge Mobile 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.

Document Tags and Contributors

Last updated by: fscholz,