示例
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
if(!window.indexedDB){
console.log("浏览器不支持indexedDB~");
}
var db,dbName = "demoDB",dbVersion = 1;
var dbStoreConf = {
title:"demoChart",
keyPath : "id",
autoIncrement:true,
index:[{
indexName:"nickname",
colName:"nickname",
unique:true
},{
indexName:"age",
colName:"age",
unique:false
}]
}
var IDBOpenDBRequest = window.indexedDB.open(dbName,dbVersion);
IDBOpenDBRequest.onerror = function(e){
console.log("创建失败~!"+ e.target.errorCode)
}
IDBOpenDBRequest.onsuccess = function(e){
db = this.result;
console.log("创建成功~!")
}
IDBOpenDBRequest.onupgradeneeded <