Opening a web page into Web browser from Symbian Web Runtime
This code snippet demonstrates how to open a web page into Web browser from Symbian Web Runtime.
Article Metadata
Code Example
Tested with
Devices(s): Nokia 5800 XpressMusic, Nokia 6220 Classic
Compatibility
Platform(s): S60 5th Edition, S60 3rd Edition FP2
Article
Keywords: widget.openURL()
Created: dekuykin
(26 Feb 2009)
Last edited: hamishwillee
(04 Oct 2012)
Contents |
Source: Relevant HTML components
<div id="bodyContent" class="bodyContent">
<label for="url">URL</label>
<input id="url" type="text" value="http://" size="16"
maxlength="256" />
<input id="openButton" type="button" value="Open"
onclick="executeSnippet();" />
</div>
Source
// Executes the snippet.
// Loads the HTML page whose URL is entered into the widget's input label.
function executeSnippet() {
// Get the URL of the specified HTML page
var url = document.getElementById('url').value;
// Encode the URL string
var urlEncoded = encodeURI(url);
// Open the HTML page
widget.openURL(urlEncoded);
}
Postconditions
The HTML page whose URL is entered in the widget's input label is opened in Web browser.
Supplementary material
This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful to developers. The version of the WRT stub application used as a template in this snippet is v1.1.
- The patched, executable application that can be used to test the features described in this snippet is available for download at Media:OpeningWebPageWRT.zip.
- You can view all the changes that are required to implement the above-mentioned features. The changes are provided in unified diff and colour-coded diff (HTML) formats in Media:OpeningWebPageWRT.diff.zip.
- For general information on applying the patch, see Using Diffs.
- For unpatched stub applications, see Example app stubs with logging framework.

