Web/API/Window/orientationchange event

From Get docs


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 StandardThe definition of 'orientationchange' in that specification. Living Standard

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

orientationchange event

Deprecated'

Chrome

No support No

Edge

No support No

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support 44

Opera Android

Full support Yes

Safari iOS

Full support Yes

Samsung 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.