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.

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
setTitle
Chrome – Full support
Chrome 4 (Release date: 2010-01-25)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 79 (Release date: 2020-07-28)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Partial support
footnote The API exists, but the title not visible in the UI.
The title property of the details parameter can be set to null.
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 18 (Release date: 2024-09-16)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support

Legend

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

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

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