Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
6 results across 6 corpora for browserAction.
Developer library 6
Add a button to the toolbar
The manifest.json key [`browser_action`](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action) is used to define the button. - The JavaScript API [`browserAction`](/docs/Mozilla/Add-ons/WebExtensions/API/browserAction) is used to listen for clicks and change the button or perform actions via your code. ## A simple button In this section we'll create an extension that adds a button to the toolbar. When t
browser_action
ons. You must specify this key to include a browser toolbar button in your extension. When specified, you can manipulate the button programmatically using the browserAction API. If you supply a popup, then the popup is opened when the user clicks the button, and your JavaScript running in the popup can handle the user's interaction with it. If you don't supply a popup, then a click event is dispatched to your exten
commands
't fire: - `_execute_browser_action`: works like a click on a [toolbar button](/docs/Mozilla/Add-ons/WebExtensions/user_interface/Toolbar_button) created with browserAction or specified in the [browser_action](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action) key in the manifest.json key. - `_execute_action`: works like a click on a [toolbar button](/docs/Mozilla/Add-ons/WebExtensions/user_interface/
Work with the Bookmarks API
arks API let's take a look at the [bookmark-it](https://github.com/mdn/webextensions-examples/tree/main/bookmark-it) example. This example adds a toolbar icon (browserAction) which, when clicked, adds or removes the current page from bookmarks. If the page is bookmarked (or removed from bookmarks) in some other way, the icon is updated to show the state of the page's bookmarking. This video shows the extension in ac
Chrome incompatibilities
### chrome.\* and browser.\* namespace Before Chrome 148, Chrome exposed APIs only under the `chrome` namespace rather than `browser`. For example, `browser.browserAction.setIcon({ path: "path/to/icon.png" });` would instead be `chrome.browserAction.setIcon({ path: "path/to/icon.png" });`. Chrome introduced support for promise-based return values from APIs in Manifest V3, with some APIs supported later. Before th
Background scripts
s running. If any cleanup is required, listen to runtime.onSuspend. ```js browser.runtime.onSuspend.addListener(() => { console.log("Unloading."); browser.browserAction.setBadgeText({ text: "" }); }); ``` However, persisting data should be preferred rather than relying on runtime.onSuspend. It doesn't allow for as much cleanup as may be needed and does not help in case of a crash. ## Convert to non-persistent