×
Namespaces

Variants
Actions
Revision as of 10:11, 28 March 2008 by dougcn (Talk | contribs)

Archived:Use prototype JavaScript library in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search


Contents

Introduction

As you may know, Prototype is a famous cross-web-browser javascript library. It supports almost all current popular web browsers, such as FireFox, Safari, IE, Opera, etc. With the latest version(Prototype 1.6.0), it also supports AppleWebKit, an open source web engine provided by Apple Inc. (It's also the web core engine of Safari web browser.)

The Nokia Web Browser is built upon S60WebKit, a port of the open source WebKit project to the S60 platform. Nokia WRT(Web-RunTime) is based on it.

Somebody would ask, "Can we use this library in the development of WRT applications?" The short answer is YES. For the long answer, I will take you through the following topics of this library:

Installation

To use prototype.js library, you need download it first and then include it in your widget applications.

Download prototype.js

First, download prototype.js from here. Second, create a folder named "javascript" or else in the root folder of your widget application. And then put prototype.js into that folder just created.

Include prototype.js in the main HTML file

The including syntax is as follows:

<script type="text/javascript" src="javascript/prototype.js"></script>

Place the above code snippet in between the head start tag( <head>) and head end tag(</head>) in the main HTML file.


Main topics

The main topics in this series are as follows:

Basic operations

This section shows how to do basice operations(utility functions,etc) with prototype.js in WRT widget application.

String manipulations

This section shows how to manipulate strings using prototype.js.

Object creation

This section shows how to define a class and a subclass, and other stuffs using prototype.js

Prototype UI

This section shows how to create a "Hello, world" window and even more using the prototype-based PWC (Prototype Window Class) or prototypeUI library in WRT widget application.

Form and AJAX(JSON)

This section shows how to make an ajax request and process the response using prototype.js in WRT widget application.

Other information

An example WRT application will be available for each topic. So, you can practice it yourself.

For the latest version of these demos, please go to here. You can check out the latest source code using a SVN client, or just download the pre-built installable wgz packages.

Conclusion

As shown in the above, prototype.js is a powerful javascript library which can be used in our WRT widget application. There are many many other features or many other prototype-based libraries which are not tested or mentioned in this series. For example, scriptaculous, a famous prototype-based javascript library, mainly focus on the UI effects. With these libraries, the development under WRT will be easier.

References

  • Prototype homepage [1]
  • Scriptaculous homepage [2]
  • PrototypeUI homepage [3]
55 page views in the last 30 days.