Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

options_ui

 
Type Object
Mandatory No
Example




"options_ui": {
  "page": "options/options.html"
}

Use the options_ui key to define an options page for your add-on.

The options page contains settings for the add-on. The user can access it from the browser's add-ons manager, and you can open it from within your add-on using runtime.openOptionsPage().

You specify options_ui as a path to an HTML file packaged with your add-on. The HTML file can include CSS and JavaScript files, just like a normal web page. Unlike a normal page, though, the JavaScript can use all the WebExtension APIs that the add-on has permissions for. However, it runs in a different scope than your background scripts.

If you want to share data or functions between the JavaScript on your options page and your background script(s), you can do so directly by obtaining a reference to the Window of your background scripts by using extension.getBackgroundPage(), or a reference to the Window of any of the pages running within your extension with extension.getViews(). Alternately, you can communicate between the JavaScript for your options page and your background script(s) using runtime.sendMessage(), runtime.onMessage, and/or runtime.connect().

In general, options changed on option pages will be stored using the storage API to either storage.sync (if you want the settings synchronized across all instances of that browser that the user is logged into, and once Firefox supports storage.sync), or storage.local (if the settings are local to the current machine/profile). If you do so and your background script(s) need to know about the change, your background script might choose to add a listener to storage.onChanged.

Syntax

The options_ui key is an object with the following contents:

Name Type Description
page String

Mandatory.

The path to an HTML file containing the specification of your options page.

The path is relative to the location of manifest.json itself.

open_in_tab Boolean

Optional, defaults to false.

If true, the options page will open in a normal browser tab, rather than being integrated into the browser's add-ons manager.

Chrome incompatibilities

options_ui

Firefox does not support:

  • chrome_style

Using options_ui requires a valid value for the applications.gecko.id property.

Example

  "options_ui": {
    "page": "options/options.html"
  }

Document Tags and Contributors

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