Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法检测浏览器/设备是否支持屏幕旋转,而不必等待orientationchange事件?仅当浏览器或设备支持时,我才尝试检测旋转本身。
我认为您可以像这样检测它:
if( 'onorientationchange' in window) { /* supported! */ }
但是,我不确定某些浏览器是否会支持该事件,即使它们从未触发它。