×
Namespaces

Variants
Actions

How-to create WRT widgets with remote code

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: mfabiop (27 Jan 2009)
Last edited: hamishwillee (25 Jul 2012)

Contents

Introduction

In this post is showed how to use JavaScript code located in the server side, when developing a WRT application. As showed in the following pictures.

Steps.jpg

Remote JavaScript

First of all, put the .js file in a public URL.

WRT Code

In the WRT application the developer can use the following code to load the .js file, put in the <head>

    <script>
var date = new Date();
var script = "\<script type='text/javascript' src='http://embedded.ufcg.edu.br/~marcos/test.js?d="+date.getMilliseconds()+"'\>\</script\>";
document.write(script);
</script>

The 'd=date.getMilliseconds()' variable is very important because with it, the WRT application doesn't use the cached .js file.

But this cached file could be used to performance, just removing the 'd=date.getMilliseconds()' variable, the WRT application will download the code only at the first time the application is opened.

When to use

The developer can use this code to load anything, external variables for use in the application or the complete application.

This page was last modified on 25 July 2012, at 10:54.
13 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×