×
Namespaces

Variants
Actions

How to create a URL Launcher Widget

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: taiwerns (21 Sep 2010)
Last edited: hamishwillee (26 Jul 2012)

Contents

Scope

This example allows you to create a URL launcher widget that has an icon in the Applications menu, but does nothing more than launch a URL (this could be a mobile site) in the browser.

Main HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> URL Launcher Widget</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript" type="text/javascript" src="basic.js"></script>
</head>
<body onLoad="javascript:init();">
</body>
</html>

JavaScript

A function to launch the specified URL in the browser and closes the widget.

var LINK_URL = "http://www.developer.nokia.com/";
// Called from the onload event handler to initialize the widget.
function init() {
widget.openURL(LINK_URL);
window.close();
}

Manifest file

Change the DisplayName and Identifier keys in the info.plist to your application name and identifier.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Nokia//DTD PLIST 1.0//EN" "http://www.nokia.com/DTDs/plist-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayName</key>
<string>URL Launcher</string>
<key>Identifier</key>
<string>com.forum.nokia.basic.launcherwidget</string>
<key>Version</key>
<string>1.0</string>
<key>MainHTML</key>
<string>index.html</string>
</dict>
</plist>

Icon file

Include an icon.png file in the package so that your icon appears in the applications menu when this is installed.

Sample Widget

Here is a sample url launcher widget application

This page was last modified on 26 July 2012, at 06:23.
57 page views in the last 30 days.
×