how to cache javascript resources?

Hello,

I have a webapplication with a couple of external-js files.

Is it possible to preload them on a pda and referring to them in the rhoelelements browser on the pda, so data is less that goes over the wifi????

Chris Misztur
Watching fiddler with Chrome

Watching fiddler with Chrome on my desktop, any external references are loaded only once, next time the remote file is only checked if it was changed, if not then it is not downloaded again.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


James Morley-Smith
There are a number of ways

There are a number of ways you could do this:  Yes, you can preload them onto the device and refer to them...you will have to use the built in local webserver in order to bypass the secutiry restrictions with x-domain and local file access.  You can either load these onto your device using the filetransfer module when you first access your site online, or simply commission them to the device when you first install the runtime.  Alternatively, and potentially the most simple and definitely the most "HTML5" would be to make use of a manifest file and implement offline app caching.  There are a bunch of tutorials online demonstrating how to do this.

Good luck,

James.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Galvin
Yes there is a way to do this

Yes there is a way to do this. The concept is called Application Caching(http://www.whatwg.org/specs/web-apps/current-work/#applicationcache) . It is part of the HTML5 features.

For a tutorial on hwo to use App Cache, check out this link: http://www.html5rocks.com/en/tutorials/appcache/beginner/

Effectively you will define what resources get cached using the manifest file. In your case you will specify that the JS files are considered Cached.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments