Widget object

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.

widget.author
A readonly attribute referring to the extension's author.
widget.authorEmail
A readonly attribute referring to the extension author's email address.
widget.authorHref
A readonly attribute referring to the extension author's website URL.
widget.description
A readonly attribute referring to the extension's description.
widget.id
A readonly attribute referring to the extension's unique ID.
widget.name
A readonly attribute referring to the extension's name.
widget.preferences
Readonly attributes that refer to the extension's preferences in key/value format.
widget.shortName
A readonly attribute referring to a shortened version of the extension's name.
widget.version
A readonly attribute referring to the extension's version number.

Overview

The widget object provides functionality for accessing an extension's metadata and persistently-stored data. It can be accessed from any of the extension's environments, such as background process, popup window, injected script or preferences page. Note that the widget object is readonly and therefore cannot be used to edit or store values on-the-fly.

Example

The below example shows how simple it is to access data within the widget object.

//
// The preferences page (e.g. options.js)
//

var footer = 'This extension is the work of <a href="' + widget.authorHref + '">' + widget.author + '</a>';
document.body.innerHTML += footer;

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

Comments

  • photo

    Fr0sT

    Thursday, October 11, 2012

    Would be very useful if you add WUID property (I mean, the one that is used in widget://wuid-b04dd551-e51b-d147-98c4-9698e25f6408/options/options.css addresses).
    Currenly one can get it like this:
    try {var wuid = /^widget:\/\/wuid\-([\w\d\-]*)\//.exec(document.URL)[1];}
    catch(ex) {wuid = null}
No new comments accepted.