gpt4 book ai didi

javascript - Cordova 5白名单、Content-Security-Policy和本地网络ip

转载 作者:行者123 更新时间:2023-11-29 19:26:13 24 4
gpt4 key购买 nike

我在尝试加载 js 文件时遇到此错误

Refused to load the script 'http://192.168.1.10/js/test.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval'

我应该使用什么策略?

这是我的元

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

以及config.xml中的白名单(root)

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

我在平台 cordova 5、android@4.0.2 上构建并在 Android 5.1.1 上测试

最佳答案

找到解决方案,我想发布;我只是忘了将 URL 添加到元数据中。

<meta http-equiv="Content-Security-Policy"
content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' http://192.168.1.10">

关于javascript - Cordova 5白名单、Content-Security-Policy和本地网络ip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30645057/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com