GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

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.onClicked.

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

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

User actions

missions from the extension's Add-on Manager permissions and data tab. For example: ```js function handleClick() { browser.sidebarAction.open(); } browser.browserAction.onClicked.addListener(handleClick); ``` In addition to enabling the APIs, these actions also enable the [`activeTab` permission](/docs/Mozilla/Add-ons/WebExtensions/activeTab_permission). This permission grants extra privileges for the tab visib

Native messaging

port.onMessage.addListener((response) => { console.log(`Received: ${response}`); }); /* On a click on the browser action, send the app a message. */ browser.browserAction.onClicked.addListener(() => { console.log("Sending: ping"); port.postMessage("ping"); }); ``` > [!CALLOUT] > To learn about debugging background scripts and viewing console output, see [Debugging background scripts](https://extensionworksho

JSON results · Services directory