如何从 Javascript 检测 Win8/Metro
如何从 Javascript 检测环境是 Windows 8 Metro 应用程序?
更新:澄清一下,我的 Javascript 代码既可以在任何浏览器上运行,也可以作为 Win8 应用程序的一部分运行。由于Win8应用程序对JS代码施加了安全限制,因此我想检测代码何时在Win8应用程序中运行。
How does one detect that the environment is Windows 8 Metro application from Javascript?
UPDATE: To clarify, my Javascript code runs both on any browser and as part of an Win8 application. Since Win8 applications impose security restrictions for JS code, I want to detect when the code is running in Win8 app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
回答我自己:
检测此问题的一种方法是检查某些 MS 特定对象或名称空间是否存在。其中之一是Windows。例如:
Answering myself:
One way to detect this is to check the existence of some MS-specific objects or namespaces. One of them is Windows. For example:
我认为你可以使用:
属性来检测它
i think you could use:
property to detect it
我使用这段代码:
I use this code: