Utilizing Offline Data in Safari

Thu,6/12 14:00

How we like our data?
  • persistent
  • fast
  • easy
  • flexible
  • secure

Cookie and Data

HTTP integration V
Persistent X
Fast V
Easy X
Flexible X
Secure V

XMLHttpRequest and Data
HTTP integration V
Persistent ?
Fast V
Easy X
Flexible X
Secure ?

Plug-ins and Data
HTTP integration V
Persistent X
Fast X
Easy X
Flexible X
Secure X

The current working spec for the HTML5 standard has a lot of exciting features we would eventually like to implement in WebKit. One feature we felt was exciting enough to tackle now even though the spec is still in flux is client-side database storage.

client-side database storage.

Each database has one version at a time, a database can't exist in multiple versions at once. Versions are intended to allow authors to manage schema changes incrementally and non-destructively, and without running the risk of old code (e.g. in another browser window) trying to write to a database with incorrect assumptions.
The client-side database storage API allows web applications to store structured data locally using a medium many web developers are already familiar with - SQL.The API is asynchronous and uses callback functions to track the results of a database query.
Compact usage defining a callback function on the fly might look something like this:


var database = openDatabase("Database Name", "Database Version");
database.executeSql("SELECT * FROM test", function(result1) {

// do something with the results

database.executeSql("DROP TABLE test", function(result2) {

// do some more stuff

alert("My second database query finished executing!");

});

});


0 评论:

Followers