在ios中已经设置了weview为wkwebview。在页面中也可以拿到indexDB的工厂对象。但是在open的时候一直是onerror!代码应该没问题,直接是w3c的demo
var note = document.querySelector("ul");
// In the following line, you should include the prefixes of implementations you want to test.
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
// DON'T use "var indexedDB = ..." if you're not in a function.
// Moreover, you may need references to some window.IDB* objects:
window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;
window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
// (Mozilla has never prefixed these objects, so we don't need window.mozIDB*)
if(!window.indexedDB){
alert("你的浏览器不兼容indexDB");
}
// Let us open version 4 of our database
var DBOpenRequest = window.indexedDB.open("toDoList", 4);
// these two event handlers act on the database being opened successfully, or not
DBOpenRequest.onerror = function(event) {
note.innerHTML = '<li>Error loading database.</li>';
};
DBOpenRequest.onsuccess = function(event) {
note.innerHTML = '<li>Database initialised.</li>';
// store the result of opening the database in the db variable. This is used a lot later on, for opening transactions and suchlike.
// db = event.detail.result;
};
a***@lechuangnet.com (作者)
要设置ios的渲染内核为wkwebview
2016-08-27 09:31
zapoi
回复 a***@lechuangnet.com:好的谢谢,不过现在已经使用了web sql数据库了。
2016-09-06 11:23