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
)
details
对象
.
tabId
integer
. The ID of the tab whose title you want to set.
title
string
or
null
. The tooltip text.
若
null
is passed here, the title is reset to the title that was specified in the
page_action
manifest key.
BCD tables only load in the browser
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
});
});
注意:
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.
最后修改: , 由 MDN 贡献者