← OS Integration
Screen Orientation
Probing…Screen Orientation is a web platform capability in the OS Integration category. Read — and on mobile, lock — the screen orientation. Supported in Chromium 38+, Firefox 43+, and Safari 16.4+.
Try it
Loading demo…
Code
console.log(screen.orientation.type, screen.orientation.angle)
screen.orientation.addEventListener('change', () => {
console.log('now', screen.orientation.type)
})
await screen.orientation.lock('landscape') // needs fullscreen + mobile
screen.orientation.unlock()Browser support
Chromium
38
Firefox
43
Safari
16.4
Frequently asked questions
Which browsers support Screen Orientation?
Supported in Chromium 38+, Firefox 43+, and Safari 16.4+.
Does Screen Orientation require HTTPS?
No. Screen Orientation works without a secure context, though serving your site over HTTPS is always recommended.
What is Screen Orientation used for?
Read — and on mobile, lock — the screen orientation.
Can I try Screen Orientation in my browser?
Yes. shwcs.net runs a live Screen Orientation demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.