Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
How to port Opera Widgets to Nokia WRT
The following contains guidelines for porting an Opera widget to the S60 Web Runtime.
This document is aimed at developers who wish to port their own Opera Widgets to Nokia WRT.
In order for the widget to be ported successfully, the widget must be originally designed for a mobile device with consideration for factors such as screen size, orientation and navigation methods.
Web standard technologies
Nokia WRT supports the following technologies:
- HTML 4.01 Specification, W3C Recommendation 24 December 1999,
- XHTML Mobile Profiles Specification, XHTML Mobile Profile Version 29-Oct-2001, WAP-277-XHTMLMP-20011029-a
- CSS Level 2 revision 1 (CSS 2.1), WAP CSS Specification Version 26-Oct-2001, WAP-239-WCSS-20011026-a
- The combination of XML, XHTML/HTML, CSS, DOM, and the XMLHttpRequest object to add Ajax capability to a widget
If the widget you wish to port uses technologies that are not in this list, then it will not function as intended without modifications to the source code.
Be aware that the library is only partially supported and as such will have reduced functionality. The following is a list of the currently supported and unsupported functionality.
Supported attributes and methods
Wrapper supported attributes and methods
- showNotification() (no callback on acknowledgement available)
Unsupported attributes and methods
Opera Geolocation API
Porting other runtime specific APIs to Nokia WRT
1. Unzip the Opera Widget package
The widget file will need to be unzipped to make modifications to its contents. To do this, its file extension may need to be changed to .zip before being extracted.
2. Create info.plist manifest file
When installing a .wgz file the system looks for a manifest file called info.plist. The Opera Widget equivalent is called config.xml.
Here's how to use the Opera Widget config.xml data to create the WRT manifest file.
- Download and unzip this info.plist template file and save it in the widget's root directory.
- Add the <DisplayName> (mandatory)
This can be found from the <widgetname> element of the config.xml file.
- Add the <Identifier> (mandatory)
An identifier is not explicitly declared in the config.xml. However, Opera widgets have an optional <id> element which contains a child <host> element containing the url of the widget and it's name. These can be formatted into the same form as the conventional WRT Identifier, which is the URL in reverse with the widget name appended to the end.
eg. widget.example.com/MyWidget → com.example.widget.MyWidget
Otherwise, a 30 digit random integer can be assigned as the identifier, which is what Opera does when it installs a widget.
- Add the <MainHTML> (mandatory)
Opera widget config.xml files contain an optional <widgetfile> element that contains the HTML file to be opened by the HTML renderer. If this element exists, it's value should be assigned to the MainHTML key in the info.plist file.
If it does not exist, then the default value, index.html should be assigned to the MainHTML key.
- 5. <AllowNetworkAccess> (optional)
Nokia's WRT does not allow fine tooth control over network access. Either all network resources are available, or none are.
Opera's config.xml contains a <security> element that contains a child <access> element, the presence of which allows the widget access to network resources. If this tag is present, then the <AllowNetworkAccess> should contain a self closing tag <true />. If not, then it should be <false />.
- <Version> (optional)
This tag facilitates updating of the widget, allowing it to check if there is a newer version available. As there is no direct equivalent property in Opera Widgets, this tag can be left out.
- Save the file.
3. Find, Move and Rename the icon
The icon file must be in PNG format, therefore if your icon is in GIF or SVG format, then you need to convert it to PNG.
It then needs to be saved in the root directory as icon.png.
Download this OperaWidget.txt file, change the extension to .js and save it to the root directory. Add the following line to the head of your main HTML file.
Opera Widgets provide special functionality via a built-in object named "widget". Nokia WRT also contains a built-in object named "widget" that cannot be extended.
As a result of this, to use the functionality provided by the Opera Widget wrapper, it needs to be referenced as operaWidget rather than widget.
Re-zip the containing folder and change the file extension to .wgz.
6. Deploy it
Upload the widget to your Nokia phone or to Nokia's Ovi portal to share it with the rest of the world.