W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
將https://js.fundebug.cn與https://web.fundebug.net添加到default-src中即可:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval' https://web.fundebug.net https://js.fundebug.cn; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
處于安全方面的考慮,Cordova 使用cordova-plugin-whitelist配置了嚴(yán)格的安全策略。
Cordova 的默認的 Content-Security-Policy 配置位于www/index.html內(nèi),如下所示:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
為了在在 Cordova 中使用 Fundebug,則需要修改Content-Security-Policy。
否則,將會遇到這些的錯誤:
加載 fundebug 腳本失?。?/p>
08-02 14:10:52.132 4185 4185 I chromium: [INFO:CONSOLE(0)] "Refused to load the script 'https://js.fundebug.cn/fundebug.1.5.1.min.js' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval' 'unsafe-inline'". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
發(fā)送錯誤數(shù)據(jù)到 Fundebug 失?。?/p>
08-02 11:10:59.848 20520 20520 I chromium: [INFO:CONSOLE(1)] "Uncaught SecurityError: Failed to execute 'open' on 'XMLHttpRequest': Refused to connect to 'https://web.fundebug.net/event/' because it violates the document's Content Security Policy.", source: https://js.fundebug.cn/fundebug.1.5.1.min.js (1)
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: