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.

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top