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

js
browser.pageAction.setTitle(
  details // object
)

Parameters

details

object.

tabId

integer. The ID of the tab whose title you want to set.

title

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

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
setTitle
The title property of the details parameter can be set to null.

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support

Examples

Whenever a tab is updated, show the page action for that tab, and set its title to show the tab's ID:

js
browser.tabs.onUpdated.addListener((tabId, changeInfo, tabInfo) => {
  browser.pageAction.show(tabId);
  browser.pageAction.setTitle({
    tabId,
    title: `Tab ID: ${tabId}`,
  });
});

Example extensions

Note: This API is based on Chromium's chrome.pageAction API. This documentation is derived from page_action.json in the Chromium code.