In other languages

Namespaces

Variants

Views

Actions

Search

Contents

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.

Nokia Asha web apps - FAQ

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.

What changed in new Nokia Asha Web Apps Runtime Proxy server release?

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://s40.nokia.com/SAWRT/3.0" required="true" />

Note that during the beta release of Nokia Asha web apps Version 3.0, support for media capture is only available on smartphones based on Nokia Asha software platform 1.0.

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

How can I make sure that my Web App works in different devices?

Nokia Asha software platform 1.0. based devices

Screen width matches Series 40 full touch devices (240px) ensuring compatibility of the web apps.
Special care must be taken to implement support for hardware back key for Nokia Asha software platform 1.0. based devices.
This is critical to offer best possible UX to end users.
Font spacing is slightly different in Nokia Asha 501, thus avoid having tight fitting text inside fixed size elements.

Series 40 Full Touch Devices

Nokia Asha 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).
To make sure that your web app works in a full touch device, verify that UI layout is not hard coded on fixed height of 320 pixels. No other actions are needed.

Can I host my application code on my own server?

To some extent, yes. You can place JavaScript resources on your server and load them into your web app.

What is the biggest or recommended file size for Nokia Asha 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 Asha Web App 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.

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.

Tools

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

Local preview is client side execution of your project's Javascript and HTML through an emulator - much like running your web app in a normal desktop browser. Local preview is useful because it allows you to debug JavaScript, and therefore helps you to spot possible errors more easily (it is also much faster for basic testing and works even if you don't have an Internet connection).

Care must be taken because local preview is the least accurate representation of how your web app will actually run on a device. It will allow you to use HTML and JavaScript that is not supported on the real proxy browser. It should not be used to verify the Nokia Asha web app user experience.

Cloud preview (by contrast) runs most of the app JavaScript and HTML in the server-side proxy browser. It reflects the actual supported feature set of HTML/JavaScript on the device and also the user experience that comes from proxy-based app execution.

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:

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.

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 Nokia Asha 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 Xpress 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 as part of application logic e.g. <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 Nokia Asha web apps?

Standard JavaScript timers do now work in distributed environment of web apps. 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:

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 Asha web app options menu?

Not in the current version. 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.

User can exit the web app using built in exit command (Series 40 platform).
In Nokia Asha software platform 1.0 based devices web app can be closed by swiping or by pressing hardware back key in main screen.

<?php// Read a GET parameter to determine the output format, if none specified, nothing is outputif(isset($_GET['output'])&&$_GET['output']!=''){$show_markup=$_GET['output'];}

// Preparing an Array with the User-Agent string. Might add more parameters in the futureif(isset($headers['User-Agent'])){$api_values['User-Agent']=$headers['User-Agent'];}switch($show_markup){case'json':header('Content-type: application/json');echojson_encode($api_values);break;

Can I use an advertising API in Series 40 web apps

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.

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/1.0.0.9.17