本文介绍了pouchdb的SCP(安全性内容策略)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在Android设备上运行 ionic 应用时,控制台中出现错误:
I see an error in the console when running my ionic app on my android device:
Refused to connect to 'blob:http%3A//192.168.0.12%3A8100/9d72a06a-c6fa-4397-976c-41ea23f90be0' because it violates the following Content Security Policy directive: "default-src *". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback. i @ pouchdb.min.js:9 (index):28 Uncaught SecurityError: Failed to execute 'open' on 'XMLHttpRequest': Refused to connect to 'blob:http%3A//192.168.0.12%3A8100/9d72a06a-c6fa-4397-976c-41ea23f90be0' because it violates the document's Content Security Policy. 192.168.0.12:8100/lib/pouchdb/dist/pouchdb.min.js Line: 9console.(anonymous function) @ (index):28它似乎与Content-Security-Policy有关,请您帮我调整一下,使其工作正常吗?
It seems to be related to te Content-Security-Policy, can you help me tune it so it works fine please ?
谢谢。 我当前的政策:
Thanks. My current policy:
index.html:
index.html:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline' fonts.googleapis; script-src 'self' 'unsafe-inline' 'unsafe-eval' *">推荐答案
对于正在寻找此错误解决方案的每个人, @baver的评论对我有用。
For everyone who's looking for a solution to this error, @beaver's comment worked for me.
我添加了以下内容:
connect-src * blob:;我还添加了 * 允许其他连接
I've also added a * to allow other connections
更多推荐
pouchdb的SCP(安全性内容策略)问题
发布评论