window.addEventListener("orientationchange", (event) => {
console.log(
`the orientation of the device is now ${event.target.screen.orientation.angle}`,
);
});Window: orientationchange event / notebook
Window: orientationchange event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
window.onorientationchange = (event) => {
console.log(
`the orientation of the device is now ${event.target.screen.orientation.angle}`,
);
};