To make `GM_setClipboard` work on different browsers.
First of all, the required permission is named
clipboardWrite, which means it just allows writing to clipboard, but not reading from clipboard.
Secondly, there is a function used in userscripts named
GM_setClipboard. It writes to clipboard, just exactly what
On Chrome, the extension can write to clipboard in the background even without
clipboardWrite permission. But on Firefox, this won't work without the permission. So
clipboardWrite permission is required to make the extension work on different browsers.
Because `browser.storage.sync` is designed to sync preferences instead of large data, and it cannot sync data between different browsers. In some browsers there is no such API implemented.
According to the document,
browser.storage.sync is designed to store preferences and sync them to different instances of the same browser with the same user logged in. And something more, up to 100KB of data can be stored and synced.
So the limitations are:
- Up to 100KB of data can be stored, even smaller than size of a feature-rich script.
- Only sync on the same browser, no share between Chrome and Firefox.
With third-party sync services (Dropbox, Google Drive, etc.):
- More data can be stored.
Scripts can be shared in Chrome, Firefox, Vivaldi, Maxthon, etc. Your scripts are synced to different browsers if only Violentmonkey is installed.