使用 contentsync 插件,我從我的服務器下載 html。檔案被下載,我得到了保存路徑等。
當嘗試使用 jquery 將 html 加載到 div 中時,VKwebview 不允許加載 file://path_to_resource。沒有錯誤,視圖只是空白。
在 android 設備上,代碼有效,所以我很確定它是 VKwebview
功能開始同步(){
var sync = ContentSync.sync({ src: imageZip, id: 'kittenZip' });
sync.on('progress', function(data) {
imageDiv.innerHTML = "<p>Syncing images: " data.progress "%</p>";
});
sync.on('complete', function(data) {
console.log(data.localPath);
$('#html_div').load("file://" data.localPath "/index.html")
}
});
sync.on('error', function(e) {
console.log('Error: ', e.message);
// e.message
});
sync.on('cancel', function() {
// triggered if event is cancelled
});
}
uj5u.com熱心網友回復:
您可以安裝cordova-plugin-ios-xhr并將首選項設定為
<preference name="allowFileAccessFromFileURLs" value="true" />
<preference name="allowUniversalAccessFromFileURLs" value="true" />
這應該可以解決file://問題
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/363006.html
上一篇:從陣列中過濾物件并選擇欄位
