我是新增的IndexedDB,我遵循本指南IndexedDB Tutorial我只是试图创建一个数据库,然后能够添加几个条目。这是我迄今为止所拥有的。“使用indexedDB.open时无法调用未定义的”错误“方法'打开'
var db = window.indexedDB.open('FriendDB', 'My Friends!');
if (db.version != '1') {
// User's first visit, initialize database (name, key, auto increment).
db.createObjectStore('Friends', 'id', true);
db.setVersion('1');
} else {
// DB already initialized.
}
var store = db.openObjectStore('Friends');
var user = store.put({name: 'Eric', gender: 'male', likes: 'html5'});
在我的控制台我得到错误“无法调用未定义的‘开放’”我怎么能得到这个工作?另外,如果网上有更好的资源可以帮助我,因为我似乎无法为新手找到关于IndexedDB主题的任何内容。
访问此链接链接http://msdn.microsoft.com/en-us/library/jj154905(v=vs.85).aspx – HariHaran 2012-07-12 05:51:49
https://developer.mozilla.org/en/IndexedDB/Using_IndexedDB is一个很好的入门教程。同时请记住,该标准最近已经发生了变化,所以旧的教程可能已经破坏了部分,不同的浏览器可能会有不同的实现(Firefox目前是最好的,但Chrome有点落后)。 – dumbmatter 2012-07-12 14:06:49