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, then I will replace end-lines with "\\r\\n"
, which makes multi-line text look better on Windows.
Two ways, at least
You can simply rely on navigator.platform
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 */ } });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.