klu*_*uka 5 mobile-safari ios indexeddb cordova wkwebview
我收到InvalidAccessError的时候我尝试在我的科尔多瓦的iOS应用程序中打开索引数据库。
平台:
我已经添加了使用WKWebview的插件,该插件至少定义了indexedDB对象,但是引发了错误。如果我通过cordova自己的网络服务器运行该代码,则该代码可在chrome,safari和移动safari中使用。
config.xml看起来像这样
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下方法打开indexedDB:
openDb: function() {
var openRequest = window.indexedDB.open(DB_NAME, DB_VERSION);
openRequest.onupgradeneeded = function(event) {
console.log('upgrade needed');
console.log(event);
myIndexDb = event.target.result;
var options = {
autoIncrement: true,
keyPath: 'key'
};
var objectStore = myIndexDb.createObjectStore(DB_STORE_NAME, options);
};
openRequest.onerror = function(event) {
console.log(event);
console.log('indexDB open Error!');
};
openRequest.onsuccess = function(event) {
console.log('open success');
myIndexDb = this.result;
};
openRequest.onblocked = function(event) {
console.log('request is blocked');
console.log(event);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4846 次 |
| 最近记录: |