×
Namespaces

Variants
Actions
(Difference between revisions)

How to create a URL Launcher Widget

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot fixing redirect link.)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetaData)
 
Line 1: Line 1:
 +
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= [[Media:LauncherExample.zip]]
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20100921
 +
|author= [[User:Taiwerns]]
 +
}}
 
[[Category:Browser]][[Category:Symbian Web Runtime]]
 
[[Category:Browser]][[Category:Symbian Web Runtime]]
 
==Scope==
 
==Scope==
Line 52: Line 74:
 
== Sample Widget ==
 
== Sample Widget ==
 
[[Media:LauncherExample.zip|Here]] is a sample url launcher widget application
 
[[Media:LauncherExample.zip|Here]] is a sample url launcher widget application
 +
[[Category:Code Examples]]

Latest revision as of 06:23, 26 July 2012

Article Metadata
Code ExampleArticle
Created: taiwerns (21 Sep 2010)
Last edited: hamishwillee (26 Jul 2012)

Contents

[edit] 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.

[edit] 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>

[edit] 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();
}

[edit] 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>

[edit] Icon file

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

[edit] 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.