问题
My app does not display camera images, instead it shows broken image, but for other images (screenshots ...) I don't face this problem.
here is the error shown : Refused to load the image because it violates the following Content Security Policy directive: "default-src *". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.
this happens only for the camera images.
any help ?
回答1:
Have you tried adding this line : <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> to your index.html?
Also, add the following :<allow-navigation href="*"/><allow-navigation href="file://*/*" /><allow-intent href="*"/> <access origin="*"/>
to your config.xml, and tell me if it works!
And just in case you didn't add it already, add the cordova-plugin-whitelist plugin !
Edit : also try adding these three more lines :
<access origin="tel:*" launch-external="yes"/>
<allow-navigation href="https://*/*"/>
<allow-navigation href="data:*"/>
and removing your <base href="/"> from your index.html.
来源:https://stackoverflow.com/questions/42788573/ionic-2-csp-on-android