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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
orientationchange event | 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.
