Question

Is there a way to detect if the browser/device supports screen rotation, without having to wait for the orientationchange event? I'm not trying to detect the rotation itself, only if the browser or device supports it.

Was it helpful?

Solution

I think you can detect it like so:

if( 'onorientationchange' in window) { /* supported! */ }

However, I'm not sure if some browsers will support the event even though they never fire it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top