Can I tell if my Chrome Extension is running on Windows?

独自空忆成欢 提交于 2019-12-01 13:11:47

Two ways, at least

  1. You can simply rely on navigator.platform

  2. Better option is to use Chrome API: chrome.runtime.getPlatformInfo():

    chrome.runtime.getPlatformInfo(function callback)

    Returns information about the current platform.

    In the form of a PlatformInfo object.

    chrome.runtime.getPlatformInfo( function(info) {
      if(info.os == "win") { /* do stuff */ }
    });
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!