a***@lechuangnet.com
a***@lechuangnet.com
  • 发布:2016-08-12 17:56
  • 更新:2016-08-25 14:49
  • 阅读:2414

在ios中已经设置了weview为wkwebview。在页面中也可以拿到indexDB的工厂对象。但是在open的时候一直是onerror

分类:HTML5+

在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;  
            };
2016-08-12 17:56 负责人:无 分享
已邀请:
zapoi

zapoi

你好我想请问下,工厂对象是怎么样获取到的。我现在连工厂对象都获取不到是要在什么地方添加什么吗?

该问题目前已经被锁定, 无法添加新回复