Sets the title of the page action. The title is displayed in a tooltip when the user hovers over the page action.
Sets the title of the page action. The title is displayed in a tooltip when the user hovers over the page action.
browser.pageAction.setTitle( details // object )
detailsobject.
tabIdinteger. The ID of the tab whose title you want to set.
titlestring or null. The tooltip text.
If null is passed here, the title is reset to the title that was specified in the page_action manifest key.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
setTitle |
Yes | 14 | 45 | ? | Yes | 14 | ? | ? | 79 | ? | 15The API exists, but the title not visible in the UI. |
? |
null |
No | No | 59 | ? | No | 14 | ? | ? | No | ? | 15 | ? |
Whenever a tab is updated, show the page action for that tab, and set its title to show the tab's ID:
browser.tabs.onUpdated.addListener((tabId, changeInfo, tabInfo) => { browser.pageAction.show(tabId); browser.pageAction.setTitle({ tabId, title: `Tab ID: ${tabId}`, }); });
Note: This API is based on Chromium's chrome.pageAction API. This documentation is derived from page_action.json in the Chromium code.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/pageAction/setTitle