回答

16

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

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

注意,它不会在[内容脚本]工作(https://developer.chrome.com/extensions/content_scripts。 html) – Troggy 2014-02-10 21:48:19

+0

此API只能在后台脚本中使用。 – 2018-03-09 11:36:40