问题
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.
http://192.168.0.12:8100/lib/pouchdb/dist/pouchdb.min.js Line: 9console.(anonymous function) @ (index):28
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:
<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' *">
回答1:
For everyone who's looking for a solution to this error, @beaver's comment worked for me.
I've added this:
connect-src * blob:;
I've also added a *
to allow other connections
来源:https://stackoverflow.com/questions/34807901/scp-security-content-policy-issue-with-pouchdb