What is the future of window.orientation?

I use window.orientation in my native iOS & Android apps. Based on the article below, should I be transitioning to some other mechanism to detect orientation? I realize, as the article states, mobile platforms, at this point, still support it.

https://developer.mozilla.org/en-US/docs/Web/API/Window/orientation

Thank you

While it’s still supported, that could change. An easy way to figure out if you’re in portrait or landscape mode is to compare the screen height to the screen width.

My bet is that window.orientation isn’t going away soon - too much software will break. You’ll see warnings in the console long before they get rid of it.

Thank you for the advice.

After some additional research, resize can accomplish the same thing and does not have the issues with deprecation. Just add the resize event to your form and then test the height and width as George mentioned…

window.addEventListener('resize', reportWindowSize);

And for Basic coders you can use:

Function window_onresize()