Reputation: 104821
How can I make a Chrome extensions that is not a popup or a button?
Where do I put my script and how do I refer to it in my *.json manifest?
Any info/links will be appreciated.
Upvotes: 2
Views: 2905
Reputation: 349222
The answers to 0 and 1 can directly be found in the documentation, specifically background pages, chrome.windows
API and chrome.tabs
API.
To bind global events, use the chrome.experimental.keybinding
API. Because this API is experimental, you have to enable it first at chrome://flags
. Also, the extension cannot be uploaded to the Chrome Web store.
If you want to add an "extension button" which performs some action on click, define a browser action and bind an event listener to chrome.browserAction.onClicked
.
To select all tabs, use chrome.tabs.query({}, callback)
method ({}
means no filter, so all tabs are selected).
Browser action buttons are always visible. If you want to create a button which is not always visible, use a page action instead. The chrome.tabs
module includes several events which can be used to find out whether your conditions are met.
As for putting up the script and the manifest file, read the documentation on Manifest files and explore some examples.
Upvotes: 7