使用此代码:
screen.orientation.lock('portrait');
在桌面版 Chrome 中出现此错误:
screen.orientation.lock() is not available on this device.
如何通过在调用之前检查 .lock() 是否可用来避免丑陋的错误?
这个问题的答案对我不起作用。