This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.
For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.
The <preference>
element allows for preferences to be declared by the developer. Using this, a key-value pair is stored in a persistent manner and is initiated the first time the extension is started. Preferences can then be accessed at runtime via the widget.preferences
object in the background process or in any page from within the extension (see the markup example below).
The following attributes are associated with it.
name
: Denotes a name for this preferencevalue
: Denotes a value for this preferencereadonly
: Indicates whether it can be overwritten at runtime or not; it is a boolean, with valid values as "true" or "false"An example of this could be the following:
<widget xmlns="http://www.w3.org/ns/widgets">
<preference name = "api-key"
value = "abcd123456"
readonly = "true"/>
</widget>
Then, in the background process:
//
// background.js
//
//gets the value the preference in the config.xml
var apiKey = widget.preferences["api-key"];