在Android设备上运行我的ionic
应用时,我在控制台中看到错误:
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.
http://192.168.0.12:8100/lib/pouchdb/dist/pouchdb.min.js Line: 9console.(anonymous function) @ (index):28
它似乎与te Content-Security-Policy有关,你能帮我调整一下吗?好吗?
感谢。 我目前的政策:
的index.html:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *">
答案 0 :(得分:1)
对于那些正在寻找此错误解决方案的人来说,@ beaver的评论对我有用。
我已经添加了这个:
connect-src * blob:;
我还添加了*
以允许其他连接