簡體   English   中英

白名單在 Ionic 中不起作用

[英]Whitelist not working in Ionic

該應用程序從某個服務器上的 php 腳本獲取 json 數據。 它在我的筆記本電腦上運行良好,但在 android 手機上不起作用。

我的 config.xml 文件中有這個

<access origin="*"/>
<allow-intent href="*"/>
<allow-navigation href="*"/>

看起來白名單不起作用..我做錯了什么?

首先通過cordova插件刪除白名單插件刪除cordova-plugin-whitelist ,然后通過cordova插件安裝添加cordova-plugin-whitelist 最后,在你的 index.html 文件中添加這些標簽<meta http-equiv="Content-Security-Policy" content="default-src *; style-src &apos;self&apos; &apos;unsafe-inline&apos;; script-src &apos;self&apos; &apos;unsafe-inline&apos; &apos;unsafe-eval&apos;">

不久前,cordova 更改為更嚴格的白名單方法。 從那時起,您需要安裝cordova-plugin-whitelist才能訪問外部資源。

事情在您的筆記本電腦上而不是在移動設備上運行的事實也指向這個方向。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM