pageAction.setTitle()
Sets the title of the page action. The title is displayed in a tooltip when the user hovers over the page action.
Syntax
browser.pageAction.setTitle(
details // object
)
Parameters
details
object
.-
tabId
integer
. The ID of the tab whose title you want to set.title
string
ornull
. The tooltip text.- If
null
is passed here, the title is reset to the title that was specified in thepage_action
manifest key.
Browser compatibility
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
setTitle | ChromeFull supportYes | EdgeFull support14 | FirefoxFull support45 | OperaFull supportYes | SafariFull support14 | Firefox for AndroidNo supportNo |
The title property of the details parameter can be set to null . | ChromeNo supportNo | EdgeNo supportNo | FirefoxFull support59 | OperaNo supportNo | SafariFull support14 | Firefox for AndroidNo supportNo |
Legend
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Examples
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: tabId,
title: "Tab ID: " + tabId
});
});
Example extensions
Acknowledgements
This API is based on Chromium's chrome.pageAction
API. This documentation is derived from page_action.json
in the Chromium code.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.