“No Content-Security-Policy meta tag found.” error in my phonegap application

后端 未结 6 722
再見小時候
再見小時候 2020-11-27 10:28

After update Cordova 5.0 in my system, I create new applications. When I tested my application on a device that time I get an error in the console log:

No Co         


        
6条回答
  •  广开言路
    2020-11-27 10:37

    You have to add a CSP meta tag in the head section of your app's index.html

    As per https://github.com/apache/cordova-plugin-whitelist#content-security-policy

    Content Security Policy

    Controls which network requests (images, XHRs, etc) are allowed to be made (via webview directly).

    On Android and iOS, the network request whitelist (see above) is not able to filter all types of requests (e.g. & WebSockets are not blocked). So, in addition to the whitelist, you should use a Content Security Policy tag on all of your pages.

    On Android, support for CSP within the system webview starts with KitKat (but is available on all versions using Crosswalk WebView).

    Here are some example CSP declarations for your .html pages:

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

提交回复
热议问题