对于 Opera Mini 使用 javascript 检测移动视图是否打开或关闭
我想向 Opera Mini 用户显示说明,以在移动视图设置打开的情况下关闭移动视图设置。为此,我需要检测它是否处于开启状态,
我该如何使用 javascript 来做到这一点
I want to show instruction to user of Opera Mini to turn mobile view setting off if the mobile view setting is on. For that I need to detect if it is ON
How can I do it using javascript
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有完全适合您的 JavaScript 解决方案,但这里有一个(尽管很弱)CSS 解决方案:Opera Mini 默认使用屏幕媒体类型,如果用户已明确切换到移动视图,则使用手持媒体类型,因此您可以在页面加载后检测 Opera Mini通过 JavaScript,然后插入一条消息,如果移动视图设置关闭,则该消息不可见,反之亦然。
然后在样式表中定义元素:
i dont have a JavaScript solution for you entirely, but here's a (albeit weak) css solution: Opera Mini uses screen media type by default and handheld media type if the user has explicitly switched to mobile view, so you could detect Opera Mini after pageload via JavaScript and then insert a message that is not visible if mobile view setting is off and vice versa.
then in the your stylesheets define the element: