Skip to content Skip to sidebar Skip to footer

Can I Tell If My Chrome Extension Is Running On Windows?

In my Google Chrome Extension I need to copy text onto the Clipboard, and I need to know if my extension is installed on Windows OS or not. Is it possible? PS. If it is Windows, th

Solution 1:

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 */ }
    });
    

Post a Comment for "Can I Tell If My Chrome Extension Is Running On Windows?"