it violates the following Content Security Policy directive: "default-src 'self' http://example.com". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.


昨天再調試APP的時候,圖片無法顯示了,看了下控制台報錯信息,發現控制台報 it violates the following Content Security Policy directive: "default-src 'self' http://example.com". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback. 這類的錯誤,在網上找了一些資料,發現是因為沒有設置img-src的緣故,在index.html中

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

添加,在default-src:*;后面添加
img-src 'self' data: base64;
之后,圖片成功顯示,問題解決。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.錯誤應該怎么解決? because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src' was not explicitly set, so 'default-s 「Jenkins」- Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback. @20210427 Electron中Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Refused to load the script xxxxxx because it violates the following Content Security Policy directive:"script-src 'self' xxxxxxxxxxxxx" 瀏覽器安全問題 解決 Jenkins 中無法展示 HTML 樣式的問題,csp問題,Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self'". react route使用HashRouter和BrowserRouter的區別-Content Security Policy img-src 404(Not found) iframe because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' 開發chrome插件報錯:Refused to execute inline event handler because it violates the following Content Security Policy directive vscode electron error (Refused to execute inline event handler because it violates the following Content Security Policy directive ... 和 Uncaught ReferenceError: process is not defined)
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM