javascript - 从 Google Chrome 扩展检测操作系统

标签 javascript google-chrome google-chrome-extension user-agent

我正在开发 Chrome 扩展程序,我需要检测 Chrome 运行在哪个操作系统上,但我似乎无法找到有关如何执行此操作的任何信息。请帮忙。 谢谢。

最佳答案

最近添加的,可以使用getPlatformInfo method在 Chrome 自己的 API 中:

chrome.runtime.getPlatformInfo(function(info) {
    // Display host OS in the console
    console.log(info.os);
});

关于javascript - 从 Google Chrome 扩展检测操作系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6376979/

相关文章:

html - CSS 动画在 Chrome 中有效,但在 FireFox 中无效

google-chrome-extension - 如何生成要在Google Chrome扩展程序中下载的文件?

google-chrome - 无法通过 Chrome 扩展\内容脚本编辑/保存 Google 日历事件

javascript - React JS View 不会在 setState() 上重新渲染

javascript - jQuery - 不使用 stopImmediatePropagation() 切换菜单;

javascript - jquery更多使用data属性的点击功能

javascript - 截图 Ionic 框架

ajax - Google Chrome 将 JSON AJAX 响应显示为树而不是纯文本

asp.net-mvc-3 - Colorbox 未加载 ajax 内容

javascript - Chrome 扩展 : Context menu on editable selected text only