hi i have a fully working phonegap application with a number of files (both .csv and .jpg) that i would like to check for updates on a web server (say ex开发者_StackOverflow社区ample.com/app) when certain pages are loaded. if there are new files i would like to overwrite the files on the phone app with these updated files
for example:
when you click to:page2.html, check for updates on 2.csv and 2.jpg
Thanks in advice
Tim
You should look into client side HTML5 storage.
I'm using the HTML5 sqllite database to store json objects relating to each page within my app. I then have a master configuration file which is in essence a sitemap with each app page, and a timestamp, when I check against the webserver configuration file copy I run a comparison to see if any files are out of date/even new and if so download and store within the client database.
Also take a look at
https://github.com/brianleroux/lawnchair
http://sixrevisions.com/web-development/html5-iphone-app/
Hope this helps
regards Andrew
On the HTML page, the same originator rule will restrict you from reading the files in javascript. I guess you have to create a method in the phonegap wrapper which will check for the files. This method can be called from within javascript.
精彩评论