首页 > 解决方案 > 如何将电容器白名单插件添加到离子应用程序

问题描述

使用cordova时,文档清楚地说明了如何将一些url添加到cordova whitlist,以便可以在我的离子应用程序的应用程序浏览器中打开它们。

$ cordova plugin add cordova-plugin-whitelist
$ cordova prepare

and then in the config.xml 
<allow-navigation href="http://example.com/*" />

<!-- Wildcards are allowed for the protocol, as a prefix
     to the host, or as a suffix to the path -->

但是我没有使用cordova而不是电容器,我找不到任何信息如何使用电容器添加白名单插件以及config.xml在哪里?关于如何去做的任何建议?

标签: xcodecordovaionic-frameworkcapacitor

解决方案


只需 npm 安装插件,电容器允许所有连接

npm install cordova-plugin-whitelist
npx cap sync

推荐阅读