HTML5: Is it possible to specify SQlite database in the Cache manifest section?
I would like to specify the SQLite database as a resource in the CACHE section of the manifest file. This will allow the script on the page to use the database offline.
I can't find anything in the HTML5 spec that says this can't be done, but I haven't had any success getting it to work.
Is it possible?
a source to share
Looking at the W3C Standalone Web Application Specification ( http://www.w3.org/TR/html5/offline.html ) there seems to be no way to include the SQLite database files in the manifest. Otherwise, it looks like it will take almost everything that has a known path relative to the website root. The database files are created by the browser in a separate directory, specific to the website, and the path is different for different browsers. My solution was to create and load the database on the first call to the application - it would be much better to be able to load the file, but I see no way to do this.
a source to share
I played with him for a while. Here's what I found:
Browser (web set) uses a database to organize Web SQL databases. :-)
For chrome, it is in (Mac OS X):
~/Library/Application Support/Google/Chrome/Default/databases/Databases.db
You can access this through SQLite3 Databases.db
:
Mine looks like:
sqlite> select * from databases;
1|http_slides.html5rocks.com_0|DBTest|HTML5 Database API example|200000
2|http_www.html5rocks.com_0|modernizrtestdb|modernizrtestdb|20000
3|http_www.html5rocks.com_0|Todo|Todo manager|5242880
4|http_experimenting.in_0|mystorage|Web SQL Storage Demo Database|1048576
5|file__0|mystorage|Web SQL Storage Demo Database|1048576
sqlite> .quit
The file ./file__0/5
contains the database for mystorage
.
Records are created when the code runs opendatabase.
I have not found a way to create an entry in this database and specify the path or filename.
a source to share
I also found a free tool that says it solves this problem - haven't had time to try it yet, but it looks like it should do the job: http://impel.simulacre.org/blog/incrementally_synchronize_html5_databases_transparently.html
a source to share