views:

281

answers:

2

I have a PHP/MySQL site I'm thinking about converting into a HTML5/JavaScript that could be run off of a users computer locally. I would like the user to be able to download my site, extract it and use it without a network connection. A static mirror of this site would hundreds of megabytes while the actual data is under 10 megabytes. Is there a way to preload the HTML5 web storage ahead of time? Or would I have to use JavaScript to load the web storage if doesn't have my data? Any ideas or pointers? Thanks

A: 

Actually, you would need "Offline Web Applications" functionality of HTML5 in order to serve pages locally (i.e. act as a local Web Server).

Another way to serve Web applications locally can be through CouchDB: easily installable on Linux (not sure on Windows) and provides an integrated Web server with of course a database. You could "push" your HTML/JS site to CouchDB from a browser provided the user installs an extension (easily done in Firefox & Chrome).

jldupont
+1  A: 

I'm not quite sure what you mean by, "A static mirror of this site would hundreds of megabytes while the actual data is under 10 megabytes," but I believe the only practical way to read/write from HTML5 storage is via JavaScript, so when they first run your app it would have to check to see if the data exists in storage, and if it's not populate it from some source using JavaScript. There's no way to "preload" it other than that AFAIK.

Jordan
I mean if I used something like wget to mirror the site locally the files on my computer would consume 200+ MBs of disk space. MySQL tells me the database itself is under 10 MBs.Ok, so no preloaded storage, I'll probably have to write some wrapper functions around the storage calls to load the data when not found.
devNoise