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. Thanks for all your past and future contributions.

Revision as of 09:55, 24 April 2013 by isalento (Talk | contribs)

Nokia Asha web apps - FAQ

From Wiki
Jump to: navigation, search

This article provides a guide to Series 40 web apps. The article answers various frequently asked questions on how to use Series 40 web apps. Series 40 web apps offer an easy entry point to mobile app development where one can utilize their web developer skills to create content with HTML, CSS, and JavaScript code.

Article Metadata
Series 40
Created: petrosoi (04 Apr 2011)
Last edited: isalento (24 Apr 2013)
Featured Article
17 Apr


Getting started

How do I get started?

What do I need to develop and test Series 40 web apps?

Support facilities

Where can I find documentation?

Series 40 web apps documentation on the Nokia Developer website

Please see also Series 40 Web App Wiki Articles

Where can I find example apps?

How do I use the support channels?

How do I report bugs?

What devices support Series 40 web apps?

A complete list of the devices that can run Series 40 web app is found in the Nokia Developer Devices section. The current web app platform version, 2.3, is supported on all above mentioned devices.

What Nokia Browser version I should use?

Use latest Nokia Browser available at At the time of writing, recommended version is v


What are new features in Series 40 Web App version 2.3

  • UI Designer in WDE
  • Web App USB deployment from a PC running Microsoft Windows
  • Automatic reloading of the simulator for locally previewed web apps as code changes are saved.
  • Additional project templates
  • Support for fixed and scrollable regions in web apps by the use of fixed headers and inline scrollable areas.

Summary of changes

How can I start using new features in use in my Web App?

If you desire to use new features in your web app, you must update Web App Version feature tag in config.xml. Feature tag defines the minimum runtime version Nokia Browser needs to support to run the Web Application.

<feature name="nokia://" required="true" />

In addition a new version of Nokia web tools is needed to support new features. You can download Nokia Web Tools here.

How can I make sure that my Web App works in Series 40 Full Touch Devices?

Series 40 Web Apps are always presented in portrait mode in Full Touch devices. The screen width of full touch device matches the width commonly used in Series 40 devices (240 px). So the only thing to make sure that your web app works in a full touch device, make sure that UI layout is not hard coded on fixed height of 320 pixels. No other actions are needed.


How do Nokia Browser for Series 40 / Series 40 web apps differ from conventional browser and web app execution environments

Nokia Browser for Series 40 is a distributed user agent. The browser client renders content compressed and formatted by the Nokia Browser for Series 40 Proxy.

For developers this means that most JavaScript is executed in the proxy rather than on the client.

This helps provide a rich web app experience in very affordable hardware that would have challenges running a full JavaScript stack.

Please read the Series 40 web apps - Platform overview document for more information.

Can I host my application code on my own server?

To some extent, yes.

You can create an app that redirects it's context to your own server, however in that case you cannot currently utilise Mobile Web Library calls to their full extent. When redirecting context to another URL, the web app execution will stop and the new resource is loaded as any other web page in the Nokia Browser.

What is the biggest or recommended file size for Series 40 web apps?

There is a limit to the size of .wgt files that can be uploaded, it's currently set to 500kb.

Debugging and testing

How can I debug or log my application?

Web Apps Simulator (one of the Nokia Web Tools) provides server side JavaScript logging with console.log() calls. Additionally, you can use the Simulator Web Inspector functionality to inspect e.g. the DOM tree or the consumed resources. Full Web Inspector functionality is available in the local preview state of the simulator, while n cloud preview mode, you can inspect the data transfer as it would happen between the proxy and client in real target devices.

Please see the simulator user guide for more information.

The first version of Series 40 web apps doesn't support logging or debugging in target hardware.

However, you can use a 3rd party logging solution such as log4javascript to flush logs to your own server script. Please refer to this example for implementing a logging solution.


What's the difference between local preview and cloud preview states in Web App Simulator?

Local preview allows you to debug JavaScript to spot possible errors more easily. Opposite to Cloud Preview, JavaScript and CSS is executed locally, thus local preview resembles functionality vise more of a standard desktop browser than a proxy based browser. Local Preview should not be used to verify Series 40 Web App user experience. Local preview was introduced in Nokia Web Tools 1.5

How to launch a Web App from command line

Please note that this is not an officially supported feature and may not be available in future releases. You can launch a Web App into the simulator from the command line using following syntax:

C:\Program Files (x86)\Nokia Web Tools 1.2.0\Web App Simulator>WebSDKSimulator.exe -f [path of Config.xml] -url [url as appearing in WDE console].


What is MWL (Mobile Web Library)?

MWL is a JavaScript library provided by Nokia for Series 40 web apps.

Direct MWL calls are the only JavaScript that will be executed on the client, thus you will find it useful to implement functionality such as view switching or timer triggered operations.

  • the MWL is automatically injected to all Series 40 web apps - you don't need to add it to your code.
  • provides functions to modify the CSS properties of DOM elements, set locally executed timers, and break out of the web app context to remote URLs.

Get an MWL overview and full API documentation for Series 40 web apps in the Developer guide and API reference.

Can I use jQuery or other popular libraries?

In many cases, yes.

However keep in mind that JavaScript is executed on the server side and remember the limitations with functionality, such as lack of native JSON parsing and timers.

Can I use any off the shelf JavaScript?

Most off the shelf JavaScript will function, but keep in mind that any non-MWL call will be executed in the proxy and execution loops will cause a client-server roundtrip.

Some important omissions

  • Native JSON parsing is not supported. Use eval() to transform raw JSON data to live data.
  • JavaScript timers (setTimeout(), setInterval()) are not supported,since they do not fit into the distributed architecture of Nokia Browser forSeries 40 / Series 40 web apps.
    • Use the MWL timer() function to work around this.

How to execute MWL calls locally on the client?

Rule of thumb: Tie MWL calls directly to DOM event handlers

  • Calls wrapped in custom JavaScript functions will always step to the server side.
function showBox(){'#box');
<!-- This click handler will execute locally -->
<a onclick="'#box');">Right way</a>
<!-- This click handler will cause a server roundtrip,-->
<!-- since it's calling a non-MWL function-->
<a onclick="showBox();">Wrong way</a>
<div class="mybox" id="box"></div>

You can chain MWL and other JavaScript calls to, for example, modify displayable elements locally before stepping to the server side:

<!--Chains locally executed MWL CSS operations and--> 
<!--a locally executed timer that triggers a server-side operated call (myajaxcall)-->
<a onclick="'#el1');mwl.hide('#el2');mwl.timer('tmr', 10, 1, 'myajaxcall(\'\')');">Chain action</a>

You can generate DOM elements with MWL event handlers in JavaScript also - this can be useful when generating new page structures from downloaded content, when you don't want to deal with massive raw HTML string operations.

var myEl = document.createElement('img'); 
myEl.setAttribute('onclick', 'mwl.toggleClass(\'#progress_anim\', \'progress_visible\');' + i + ');');

Pay extra attention on quotation marks, when attaching MWL event handlers in JavaScript.

document.getElementById("btn").innerHTML = "<div onclick=\'mwl.toggle(\"#tg1\");return false;\'>wrong</div>";
document.getElementById("btn2").innerHTML = "<div onclick=\"mwl.toggle(\'#tg1\');return false;\">right</div>";

Why is my code causing round trips to the server when JavaScript is executed?

See the answers above.

  • JavaScript wrapped in non-MWL calls will always step to the server for execution.
  • One good approach is to build a logic that downloads and generates fairly large DOM structures:
    • The DOM structure should then be split to visible and hidden parts that can be toggled between with direct locally executed MWL calls.
    • The RSS reader template in Nokia Web Tools is a good example of this approach.

Can I use alert() ?

alert() is not supported in Series 40 Web Apps. Use console.log() instead.

Can I use "javascript: ..." to invoke JavaScript functions from anchor tags?

No. The construct "javascript: ..." is not supported on the proxy server. If used, it may result in a new web page being opened in the Series 40 browser and as a result the web app will no longer behave as expected. Where JavaScript function need to be invoked in an anchor tag it should be done using <a onclick="javascript function">.

How do I add a content refresh option to my web app?

If you wish to add an ad-hoc refresh capability to your web app, it should be done using <a onclick="refreshPageContent();">. The more conventional options of window.location.reload(); or the syntax <a href="javascript:refreshPageContent();" should be avoided as they cause the web app context to be lost, which results in the web app no longer behaving as expected.

APIs and features

How do I use timers in Series 40 web apps?

Standard timers don’t perform well when run on the proxy server rather than a phone. To overcome this issue, when timer features are need, use the MWL timer() and stopTimer() methods. Note that when using the timer() and stopTimer() methods that inline coding should be used: these methods will not trigger from a subroutine attached to the event. Typically this means your code should be similar to:

function callFunc() {
// Process event here...
</head> <body onload="mwl.timer
('timer1', 5000, 0, 'callFunc()');"

For more information, see Series 40 Web Apps Developer’s Guide and API Reference.

Does Nokia Browser for Series 40 / Series 40 web apps environment support HTML5

The current version of Series 40 web apps doesn't have support for HTML5 features.

What CSS3 features are supported?

Animated 2D transitions of width, height, and margin properties are supported with the -webkit -prefix. Use MWL calls such as addClass to run animations on the client side.

More information is available in the Series 40 web apps - Developer guide and API reference

Rounded corners, gradients, and other CSS3 visual effects are not supported in current version of Series 40 web apps.

What URI schemes are supported?

http, https, tel and sms.

Can I call, or send sms or email?

Initiating calls with tel URI scheme is supported.

<a href="tel:+3581234567p123">Dial</a>
<a href="tel:+3581234567p123">Dial - then pause before sending a new number</a>
<a href="tel:+3581234567w123">Dial - then ask the user if he wants to send a new number</a>

SMS sending is supported from Series 40 Web Apps 1.5 onward.

<a href="sms:+35801234567?body=hello%20world">SMS</a>

For more information see SMS URI scheme in Series 40 web apps

Email creation is not supported.

How do I playback or stream video or audio?

Current version of web apps enables you to launch video and audio playback using the native player on the device.

However, the use case flow shows a screen prompting the user to start playback of the media file.


<a href="#" onclick="mwl.loadURL('');">Play video</a>

Find information on the supported formats and codecs from web app compatible device specs at Nokia Developer

Embedding video files is not possible in the first version of web apps.

Functionality on the simulator differs from real devices, therefore it's recommended highly that multimedia functionality is tested on a device.

Can I create custom items for the Nokia Browser for Series 40 options menu?

Not in the current version of Series 40 web apps. You need to create your own menu with HTML. From version 2.3 onwards, fixed and scrollable region support enables you to make stationary menus.

Can I tie an event handler to the Nokia Browser for Series 40 Back-button?

Not in the current version of Series 40 web apps. You need to create a custom Back-button for navigation inside your app context.

How can I close my app from JavaScript code?

window.close() and the other options you might normally use aren't supported in the current release of Series 40 web apps.

Apps are run in Nokia Browser for Series 40 context and users can exit the browser as they normally do.

How can I detect resolution or other client side parameters?

The wiki article Coding Series 40 web apps for screen orientation describes how to detect and react to landscape and portrait screen formats.

Can I discover device features, such as whether my web app is running on a Touch and Type device?

You can discover the characteristics and feature of the device upon which a web app is running by looking at the http request headers sent by your web app and received by a remote web server.

We have set up simple php scripts to get text and JSON output of your user agent string:


The server side scripts for the above are fairly simple and can be freely copied if required: Apache server rewrites:

<IfModule mod_rewrite.c> 
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} /js.*
RewriteRule js.(.*) /index.php?output=$1 [L]


// Read a GET parameter to determine the output format, if none specified, nothing is output
if (isset($_GET['output']) && $_GET['output'] != '') {
$show_markup = $_GET['output'];
// Preparing an Array with the User-Agent string. Might add more parameters in the future
if (isset($headers['User-Agent'])) {
$api_values['User-Agent'] = $headers['User-Agent'];
switch ( $show_markup ) {
case 'json':
header('Content-type: application/json');
echo json_encode($api_values);
case 'xml':
// not implemented
case 'text':
header('Content-type: text/plain');
echo $api_values['User-Agent'];

This is example JavaScript code to call the above mentioned URLs at and obtaining the real user agent string of the Nokia Browser for Series 40 client:

function handleResponse(content){ 
document.getElementById("ua").innerHTML = content;
function getLogMe(){
var xhr;
var myurl = "";
xhr = new XMLHttpRequest();"GET", myurl, true);
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
xhr.onreadystatechange = function(){
if (xhr.readyState == 4) {
if (xhr.status == 200) {
if (xhr.responseText != null) {
// Work with the response
// something is wrong
return '';
// something is wrong
return '';
//send the request

This would give you the real user agent string to play with, after which you can determine what device the browser is running on.

Can I store data locally on the client?

Local storage isn't supported in the first version of Series 40 web apps, however you can use widget.preferences to store data in cloud.

You can use the preferences attribute of W3C Widget Interface to store application instance specific persistent data in the Nokia Browser for Series 40 proxy. For details see: Using widget.preferences in Series 40 Web Apps

Do you provide an API to query user's location?

W3C Geolocation API getCurrentPosition() is supported in Series 40 Web Apps Version 1.5 onwards. Note that Version 1.0 of Series 40 web apps doesn't provide location APIs. Please note that anonymous functions cannot be passed to getCurrentPosition() as arguments.

function getPosition()
navigator.geolocation.getCurrentPosition(geoSuccess, geoFailure);
// geolocation API is not available, handle the case here
function geoSuccess(position){
* handle success here
* use: position.coords.latitude, position.coords.longitude
* position.coords.accuracy and position.timeStamp

function geoFailure(error){
* handle failure here
* use: error.code and error.message


A user agent IP lookup also returns the IP of the data centre of Nokia Browser for Series 40 Proxy through which the network traffic is routed.

Do you support device APIs?

Device APIs, other than W3C Geolocation API, aren't supported in the current version of Series 40 web apps.

Do you support Flash?

There is no Flash support in Series 40 web apps / Nokia Browser for Series 40.

Can Series 40 web apps integrate to device home screen?

Home screen integration isn't supported in the first version of Series 40 web apps.

Can I use a map API in Series 40 web apps?

Yes. Any map service that outputs static images (png, gif, jpeg) should do.

Map Image API provides an easy to use REST interface for accessing, for example, map tiles.

Can I use an advertising API in Series 40 web apps

Nokia doesn't currently offer a publicly available Series 40 web apps optimised ad-solution. 3rd party mobile JavaScript ad-frameworks should work, but haven't been rigorously tested in this environment.

I need to integrate to Facebook and Twitter from my web app, how do I do it?

Current Series 40 web apps development offering doesn't contain frameworks for integrating to popular social networks. Thus, you need to implement integration points yourself or use third-party frameworks.

Do you have a recommended UI library?

The current version of Series 40 web apps doesn't include a full UI library.

  • Web Templates provide HTML and CSS styles that can be used in NokiaBrowser for Series 40 and Series 40 web apps.

How can I customize the favicon that is displayed for my web app within Nokia Browser for Series 40 favourites?

To customize the favicon for your app, simply add the following line within index.html:

<link rel="icon" type="image/png" href="favicon.png">

The favicon image file should be 16x16 PNG format with a transparent background.


How do I port my existing web site?

Although Nokia Browser for Series 40 can render most web content well, it's recommended to optimise the content and layout sent to Nokia Browser for Series 40 clients, to do this for your website:

  • Familiarise yourself with this FAQ, the overview guide, and the practices guides to understand the limitations in features such asJavaScript execution, CSS support, and event handling.
  • Keep in mind that Nokia Browser for Series 40 clients run in affordable mobile phones with QVGA screens in landscape or portrait resolution.
  • Detect Nokia Browser for Series 40 clients by looking for matches within the example UA string.

Can I create a redirecting launcher app that points to my existing website?

Yes, you can. To create the simplest possible packaged web app, just do a simple redirect in your JavaScript, for example:

document.location.href = "";

However, remember that MWL will only be injected to the initial page of your application and MWL calls don't currently execute locally in the client if the code is hosted from your own server.

How do I port my existing Symbian WRT widget or other packaged web app?

Some things to check and remember:

  • Series 40 web apps use W3C widget packaging format, which is different from Symbian WRT.
  • As with porting between any other environments, API and feature differences exist. For example, Series 40 web apps don't currently support any device APIs.
  • JavaScript (except direct MWL calls) execute on the server, thus many apps with heavy client side logic, DOM manipulation, etc. would benefit from redesign ofthe code to optimise the need for server round trips.

In many cases, it's worthwhile considering redesigning your application rather than attempting to port.


How do I find out the version of Nokia Browser running on my device

Select Tools -> About in Nokia Browser Options menu

What is the user agent string for the Nokia Browser for Series 40 / Series 40 web apps clients

Example user agent strings:

  • Nokia Browser for Series 40 Version 1.0
    • Mozilla/5.0 (Series40; NokiaX3-02/05.65; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40NokiaBrowser/
  • Nokia Browser for Series 40 Version 1.5
    • Mozilla/5.0 (Series40; NokiaX3-02/06.00; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/

However, as the browser was previously known as Ovi Browser some implementation will report ‘OviBrowser’, as in the following example user agent string: Mozilla/5.0 (Series40; NokiaX3-02/05.65; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/

How do I find out the firmware version of my device?

Dial *#0000# in the home screen of your device.


Where can I publish my app?

You can publish your web apps through Nokia Store.

448 page views in the last 30 days.