By Opera Software

From Opera 15 onward, Opera 11 & 12’s extension format is no longer supported, and instead, we’ve switched to Chromium’s extension model. Check out our new documentation for developing extensions for Opera 15 and higher and start building your own extensions.


This readonly attribute implements a HTML5 DOM Storage interface that allows read/write access to the name and values of any preference elements declared in the configuration document. Read more about how to make use of widget.preferences in the options page for your extension.


HTML section of options.html:

<!doctype html>


<fieldset id="prefs-form">
<legend>Game Options</legend>
  <label>Volume:  <input type="range" min="0" max="100" name="volume"/> </label>
  <label>Difficulty:  <input type="range" min="0" max="100" name="difficulty"/> </label>
  <input type="button" value="Save" onclick="savePrefs()"/>
  <input type="button" value="load" onclick="loadPrefs()"/>


JavaScript section of options.html:

var form   = document.getElementById("prefs-form");
var fields = form.querySelectorAll("input[type='range']");

// Get the preference values from the widget object
function loadPrefs() {
  for (var i = 0; i < fields.length; i++) {
    var field = fields[i];
    if (typeof widget.preferences[field.name] !== "undefined") {
      field.value = widget.preferences.getItem(field.name);

// Set the preference values for each field
function savePrefs () {
  for (var i = 0; i < fields.length; i++) {
    var field = fields[i];
    widget.preferences.setItem(field.name, field.value);

This article is licensed under a Creative Commons Attribution 3.0 Unported license.


No new comments accepted.