Widget packaging and configuration support in Opera Presto 2.9

W3C references
W3C Widget Packaging and Configuration
W3C Widgets 1.0: Requirements

Opera Presto offers support for W3C Widgets, as described in the following sections.

W3C Widget internationalization model

Opera Presto supports the W3C Widget internationalization model.

W3C Widget global attributes

The following attributes are global, and not bound to any one element.

Global attribute Description Support
xml:lang The value of the xml:lang attribute needs to be unique for any subsequent element of this type. Usage is optional. Yes
dir Represents a valid dir (directional) value. Usage is optional. Yes

W3C Widget configuration document: elements and attributes

Element Attributes Description Support
<widget> This is the root element and serves as a container for the other elements of the configuration document. Yes
defaultlocale Denotes the default language that a user agent should use if it does not support any of the languages specified in the widget. Usage is optional. No
id Denotes an identifier for the widget. Usage is optional. Yes
version Specifies the version of the widget. Usage is optional. Yes
height A numeric attribute greater than 0 that indicates the preferred viewport height of the instantiated custom start file in CSS pixels. Usage is optional. Yes
viewmodes Denotes the author's preferred view mode, followed by the next most preferred view mode, and so forth. Usage is optional. Opera offers partial support, pending further development of the specification. Yes
width A numeric attribute greater than 0 that indicates the preferred viewport width of the instantiated custom start file in CSS pixels. Usage is optional. Yes
<name> Represents the full human-readable name for a widget that is used; for example, in an application menu or in other contexts. Yes
short A string that represents a condensed name for a widget (e.g., a name that could be used in context were only limited space is available, such as underneath an icon). Usage is optional. Yes
<span> This is a wrapper for text content and can be used with the global attributes. Usage is optional.
  • When combined with the dir attribute, it can indicate the textual directionality of text content.
  • When combined with the xml:lang attribute, it indicates the particular language used for a subset of text content within another element.
Yes
<description> Represents a human-readable description of the widget. Yes
<author> Represents people or an organization attributed with the creation of the widget. Yes
href Its value represents an IRI that the author associates with himself or herself (e.g., a homepage, a profile on a social network, etc.). Usage is optional. Yes
email A string that represents an email address associated with the author. Usage is optional. Yes
<license> Represents a software license which includes, for example, a usage agreement, redistribution statement, and/or a copyright license terms under which the content of the widget package is provided. Yes
href A valid IRI or a valid path that points to a representation of a software and/or content license. Usage is optional. Yes
<icon> Represents a custom icon for the widget. Yes
src Points to a file inside the widget package. When an icon element is used, it is required for authors to use the src attribute. Yes
width This is a numeric attribute greater than 0 that represents, in CSS pixels, the author's preferred width for the icon. Usage is optional. Yes
height A numeric attribute greater than 0 that represents, in CSS pixels, the author's preferred height for the icon. Usage is optional. Yes
<content> Used by an author to declare which custom start file the user agent is expected to use when it instantiates the widget. Yes
src Allows an author to point to a file within the widget package. When a content element is used, it is required for authors to use the src attribute. Yes
type Indicates the media type of the file referenced by the src attribute. Usage is optional. Yes
encoding Denotes the character encoding of the file identified by the src attribute. The value is the "name" or "alias" of any character set. The default encoding is UTF-8, which has the name "UTF-8" in the IANA-Charsets registry. Usage is optional. Yes
<feature> A feature is a URI identifiable runtime component (e.g. an Application Programming Interface or video decoder). The feature element serves as a standardized means to request the binding of an IRI identifiable runtime component to a widget for use at runtime. Using a feature element denotes that, at runtime, a widget can attempt to access the feature identified by the feature element's name attribute. A feature has zero or more parameters associated with it. Yes
name Identifies a feature that is needed by the widget at runtime (such as an API). When the feature element is declared, it is required for authors to use the name attribute. Yes
required A boolean attribute that indicates whether or not this feature has to be available to the widget at runtime. When set to true, the required attribute denotes that a feature is absolutely needed by the widget to function correctly, and without the availability of this feature the widget serves no useful purpose or won't execute properly. When set to false, the required attribute denotes that a widget can function correctly without the feature being supported or otherwise made available by the user agent. Usage is optional. Yes
<param> Defines a parameter for a feature. A parameter is a name-value pair that is associated with the corresponding feature to which the parameter is declared. An author establishes the relationship between a parameter and feature by having a <param> element as a direct child of a <feature> element in document order. Yes
name A string that denotes the name of this parameter. When a <param> element is declared, it is required for authors to use the name attribute. Yes
value A string that denotes the value of this parameter. When a <param> element is used, it is required for authors to use the value attribute. Yes
<preference> Allows authors to declare one or more preferences. A preference is a persistently stored name-value pair that is associated with the widget the first time the widget is initiated. Yes
name A string that denotes the name of this preference. When a preference element is used, it is required for authors to use the name attribute. Yes
value A string that denotes the value of this preference. Usage is optional. Yes
readonly A boolean attribute indicating whether this preference can, or cannot, be overwritten at runtime (e.g., via an author script). Usage is optional.
  • When set to true, it means that the preference cannot be overwritten.
  • When set to false, it means that the preference can be overwritten.
Yes

Example

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns       = "http://www.w3.org/ns/widgets"
        id          = "http://example.org/exampleWidget"
        version     = "2.0 Beta"
        height      = "200"
        width       = "200"
        viewmodes   = "fullscreen">

  <name short="Example 2.0">
    The example Widget!
  </name>

  <feature name="http://example.com/camera">
    <param name="autofocus" value="true"/>
  </feature>

  <preference name     = "apikey"
              value    = "ea31ad3a23fd2f"
              readonly = "true" />

  <description>
    A sample widget to demonstrate some of the possibilities.
  </description>

  <author href  = "http://foo-bar.example.org/"
          email = "foo-bar@example.org">Foo Bar Corp</author>

  <icon src="icons/example.png"/>
  <icon src="icons/boo.png"/>
  <content src="myWidget.html"/>

  <license>
Example license (based on MIT License)
Copyright (c) 2008 The Foo Bar Corp.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
INSULT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  </license>
</widget>

Documentation

Opera Help

Need help? Hit F1 anytime while using Opera to access our online help files, or go here.