Screen orientationchange is a deprecated, non-standard instance event that fired when the device orientation changed. Learn the old addEventListener / onorientationchange shapes, how it differs from Window orientationchange and from Screen change, and how to migrate to screen.orientationchange—with five examples and try-it labs.
01
Kind
Instance event
02
Type
Event
03
Status
Deprecated · Non-standard
04
Handler
onorientationchange
05
Modern path
orientation.change
06
Fires when
Device rotates
Fundamentals
Introduction
When a phone rotates from portrait to landscape, layouts often need a refresh. Older code sometimes listened for orientationchange on screen (or on window).
That Screen event is obsolete. Modern browsers expose orientation updates on screen.orientation via the Screen Orientation API. This tutorial covers the legacy Screen event so you can read old snippets and migrate them safely.
JavaScript
// Legacy only — do not use in new apps
// screen.addEventListener("orientationchange", () => { /* … */ });
💡
Beginner tip
For new work, always prefer screen.orientation.addEventListener("change", …) and then read type / angle.
Concept
Understanding the Event
MDN: the orientationchange event fires when the device’s orientation has changed.
Instance event — historically associated with Screen.
Deprecated & Non-standard — not in any specification.
Generic Event — no special orientation payload fields.
Replacement — ScreenOrientationchange.
Foundation
📝 Syntax
Use the event name with addEventListener, or set the handler property:
Examples follow MDN Screen: orientationchange event. Labs mostly feature-detect and show the modern replacement—legacy listeners often never fire on today’s browsers.
📚 Getting Started
Detect legacy hooks without relying on them for UX.
Example 1 — Feature-Detect Legacy Hooks
See whether onorientationchange exists on screen.
JavaScript
console.log({
hasOnorientationchange: "onorientationchange" in screen,
typeofHandler: typeof screen.onorientationchange,
tip: "Screen orientationchange is deprecated & non-standard — prefer orientation.change"
});
Screen orientationchange is Deprecated and Non-standard. Prefer screen.orientationchange. Logos use the shared browser-image-sprite.png sprite from this project. Do not rely on the legacy event for production.
✓ Deprecated · Non-standard
Screen orientationchange
Legacy rotate event — use ScreenOrientation.change instead.
LegacyAvoid in new apps
Mozilla FirefoxPrefer screen.orientation change
Avoid legacy
Google ChromeUse ScreenOrientation.change
Avoid legacy
Microsoft EdgePrefer modern Screen Orientation API
Avoid legacy
Apple SafariDo not rely on Screen orientationchange
Avoid
OperaFollow Chromium Screen Orientation API
Avoid legacy
Internet ExplorerLegacy-era only — migrate away
Legacy
orientationchangeDeprecated
Bottom line: Feature-detect only for migration. Prefer screen.orientation.addEventListener("change", …) and read type/angle. Keep responsive CSS as a baseline.
Wrap Up
Conclusion
Screen orientationchange was a deprecated, non-standard way to notice device rotation. Feature-detect it only when migrating legacy code, and use screen.orientationchange for new work.
Use Screen orientationchange in new production apps
Assume attaching a listener means the event will fire
Confuse it with experimental Screen change
Skip checking MDN’s Deprecated and Non-standard warnings
Require orientation events for core product flows without a fallback
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about orientationchange
Deprecated non-standard Screen rotate event.
5
Core concepts
📱01
Event
on Screen
Kind
⚠️02
Deprecated
avoid in new code
Status
🚫03
Non-standard
no public spec
Spec
🔄04
Modern
orientation.change
Replace
🎯05
Fallback
CSS + detect
UX
❓ Frequently Asked Questions
It is a deprecated, non-standard event that fired when the device orientation changed. Prefer the ScreenOrientation change event on screen.orientation instead.
MDN marks Screen: orientationchange as Deprecated and Non-standard. It is not Experimental. Do not use it in new code.
Listen for change on screen.orientation: screen.orientation.addEventListener("change", handler). That is the Screen Orientation API path MDN recommends.
Use addEventListener("orientationchange", handler) or the onorientationchange property on Screen (or historically on window for the Window version).
A generic Event. Re-read orientation details after it fires (or use the modern API’s type and angle).
They are related legacy ideas. Window: orientationchange is also deprecated. Screen: orientationchange is additionally Non-standard. Prefer ScreenOrientation.change for both migration paths.
Did you know?
MDN lists a separate deprecated orientationchange on Window as well. Even if "onorientationchange" in window is true, new apps should still migrate to screen.orientationchange—not keep either legacy listener forever.