Closed i5ting closed 9 years ago
考虑使用 https://github.com/axemclion/IndexedDBShim
IndexedDB Polyfill Build Status A polyfill to enable IndexedDB using WebSql.
IndexedDB is not supported on all browsers. This IndexedDB polyfill exposes the IndexedDB API in unsupported browsers using WebSQL. This shim is basically an IndexedDB-WebSql adapter.
More details about the project at gh-pages
Using this polyfill, you can use a single offline storage API across browsers (Opera, Safari, Firefox, Chrome and IE10) and even mobile devices (Phonegap on iOS and Android).
目前状态
var collection = new Collection('message_test');
collection.use_websql();
var obj = {
type :'type',
mid :'mid',
uid :'uid',
uname :'uname',
avatar :'avatar',
sid :'sid',
sname:'sname',
timestamp :'timestamp',
msg :'msg'
}
// ok
collection.add(obj);
// ok
collection.save();
http://www.w3.org/TR/IndexedDB/