在Chrome打包的应用中检测底层操作系统 [英] Detect the underlying OS in a Chrome Packaged App
本文介绍了在Chrome打包的应用中检测底层操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于打包的应用程序可以在不同的平台上运行,因此有什么方法可以区分Windows和Mac吗?
Since packaged apps can run on different platforms, is there any way to distinguish between Windows and Mac ?
我想展示一些相对于键盘快捷键的帮助,并且能够检测到操作系统将有助于例如显示 Command⌘ C 或 Ctrl C .
I would like to show some help vis-à-vis keyboard shortcuts and being able to detect the OS would help in for example showing Command ⌘C or CtrlC accordingly.
推荐答案
您可以在JS中使用window.navigator
.通常,这些信息将包含您要查找的信息.可能在window.navigator.platform中.
You can use window.navigator
in JS. Typically that will have the information you're looking for. Probably in window.navigator.platform.
这篇关于在Chrome打包的应用中检测底层操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文