[英]@ionic/angular 4.0.0-beta.13 : Not allowed to load local resource : with webview 2.2.3 - Ionic CLI 4.3.1
從相機拍攝照片后,這些路徑就來了。
file:///data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg
我使用Ionic 4,其中WebView 為2.2.3,通過應用觀察到所有類型的回復,但沒有效果。
"cordova-plugin-ionic-webview": "2.2.3"
我曾經回答過這個
所以我沒有在設備上顯示應用程序,這個應用程序不一樣。
Failed to load resource: net::ERR_FILE_NOT_FOUND
我已經找到了我的問題的解決方案。
我已經完成了這個鏈接,它工作得很好。
https://devdactic.com/ionic-4-image-upload-storage/
而在我的 config.xml 中,extra 沒有寫任何東西。
總之:新的 webview 插件不支持file:/// url
首先使用this.webview.convertFileSrc(img);
函數將url
轉換為http://localhost:<post>/url
this.webview.convertFileSrc(img);
像這樣返回這個函數值http://localhost:8080/_file_/data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg
我的建議使用上面的鏈接解決同樣的問題......
請嘗試將其添加到您的 config.xml 中:
<access allows-arbitrary-loads-for-media="true" allows-arbitrary-loads-in-web-content="true" allows-local-networking="true" origin="*"/>
<allow-navigation href="data:*"/>
<allow-navigation href="*"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.