pageAction.setTitle()
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.
Syntax
browser.pageAction.setTitle(
details // object
)
Parameters
details- :
object.tabId- :
integer. The ID of the tab whose title you want to set. title-
:
stringornull. The tooltip text.If
nullis passed here, the title is reset to the title that was specified in thepage_actionmanifest key.
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,
title: `Tab ID: ${tabId}`,
});
});
Browser compatibility
[!NOTE] This API is based on Chromium's
chrome.pageActionAPI. This documentation is derived frompage_action.jsonin the Chromium code.