pageAction.show()

Shows the pageAction for a given tab. The page action is shown whenever the given tab is the active tab.

show() overrides pattern matching, so the page action will be shown in the specified tab even if show_matches does not match the URL or hide_matches does.

Note that calling show() has no effect on a tab with no content loaded.

Syntax

js
browser.pageAction.show(
  tabId // integer
)

Parameters

tabId

integer. The ID of the tab for which you want to show the page action.

Return value

A Promise that will be fulfilled with undefined.

Examples

This example shows the pageAction for the active tab when the user selects a context menu item.

Note: You'll need the contextMenus permission in your manifest to create context menu items.

js
browser.contextMenus.create({
  id: "show",
  title: "Show page action",
});

browser.contextMenus.onClicked.addListener((info, tab) => {
  if (info.menuItemId === "show") {
    browser.pageAction.show(tab.id);
  }
});

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
show
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 – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 50 (Release date: 2016-11-15)
footnote
footnote Before version 56, the 'tabId' parameter was ignored, and the page action was shown for all tabs.
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

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

Full support
Full support
No support
No support
See implementation notes.

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