sidebarAction.setTitle()

Sets the sidebar's title. The title is displayed anywhere the browser lists available sidebars. For example, Firefox will show it in the "View > Sidebar" menu. It's also shown at the top o the sidebar when the sidebar is open.

You can pass a tabId in as an optional parameter. If you do this then the title is changed only for the given tab.

Syntax

browser.sidebarAction.setTitle(
  details // object
)

Parameters

details
object. The new title and optionally the ID of the tab to target.
title
string. The sidebar's new title.
tabIdOptional
integer. Sets the title only for the given tab. The title is reset automatically when the tab is closed.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic supportNoNo54NoYes

Examples

This code changes the title for the sidebar when the user clicks a browser action, but only for the current tab:

var title = "A different title";
function setTitleForTab(tab) {
  browser.sidebarAction.setTitle({title, tabId: tab.id});    
}
browser.browserAction.onClicked.addListener(setTitleForTab);

Acknowledgements

This API is based on Opera's chrome.sidebarAction API.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,