danlucraft /blog

How does offline iPhone storage work?

November 2008 • Daniel Lucraft

There is an application called iAnki for the iPhone which lets you navigate to a website on your iPhone, and then use that website offline. How does this work???

I think it’s using the page DOM to store the information, and then JavaScript in the page acts as an interface. But I didn’t think that the iPhone could cache pages like that.

I must figure out how to do this. The possibilities are so tantalizing!

Update Mystery solved. I remain very impressed. It turns out that Webkit has implemented the HTML 5 standard for SQL data storage. Since Safari is based on Webkit and the iPhone uses Safari, the iPhone has HTML 5 data storage too.

This means is that you can write an HTML page that uses JavaScript to execute SQL in the database. I’ve started writing a To-do list page for practice, but it’s difficult because I’m not sure where to look for the JavaScript API documentation.

blog comments powered by Disqus