Page actions

Page actions are like browser actions in most respects, except that:

  • browser actions are displayed all the time, and are for actions that are applicable more or less all the time
  • page actions are for actions which only make sense on certain pages, and are only displayed when those tabs are active.

To emphasise that page actions are closely tied to particular pages, they're shown inside the address bar, rather than the main toolbar:

Unlike browser actions, they're hidden by default, and you call pageAction.show() and pageAction.hide() to show or hide them in specific tabs.

Specifying the page action

You define the page action's properties - icon, title, popup - using the page_action key in manifest.json:

"page_action": {
  "browser_style": true,
  "default_icon": {
    "19": "button/geo-19.png",
    "38": "button/geo-38.png"
  },
  "default_title": "Whereami?",
  "default_popup": "popup/geo.html"
}

The only mandatory key is default_icon. You can change any of these properties programmatically, and show/hide the page action, using the pageAction API.

Examples

The chill-out example WebExtension uses a page action.

Document Tags and Contributors

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