Options pages

Options pages enable you to define preferences for your WebExtension that your users can change. Users can access the options page for an add-on from the browser's add-ons manager:

The way users access the page, and the way it is integrated into the browser's user interface, will vary from one browser to another.

You can open the page programmatically by calling runtime.openOptionsPage().

Options pages have a Content Security Policy that restricts the sources from which they can load resources, and disallows some unsafe practices such as the use of eval(). See Content Security Policy for more details on this.

Specifying the options page

To create an options page:

  • write an HTML file defining the page. This file can include CSS and JavaScript files, just like a normal web page. JavaScript running in the page can use all the WebExtension APIs that the add-on has permissions for. In particular, you can use the storage API to persist preferences.
  • package these files in your add-on
  • include an options_ui key in manifest.json, giving it the URL to the page.

Examples

The favourite-colour example WebExtension uses an options page.

Document Tags and Contributors

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