Home > Uncategorized > Refused to load gap://ready #Phonegap #Cordova #CSP

Refused to load gap://ready #Phonegap #Cordova #CSP

screen-shot-2017-01-29-at-13-55-12
[Error] Refused to load gap://ready because it appears in neither the child-src directive nor the default-src directive of the Content Security Policy.

I noticed in an app I just updated, that the phonegap plugins were not working, (i.e. InAppBrowser), but deviceReady was getting called, so it it was ‘sort of’ working.

When I attached the remote debugger to the app from Safari I saw the error above in the console window being fired  over and over again.

The fix was to relax the CSP in the index.html, by adding

<meta http-equiv=”Content-Security-Policy” content=”default-src ‘self’ gap://ready file://* *; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval'”>

You have to make sure you only have one CSP meta tag, as it will only use the first one.

 

Categories: Uncategorized
  1. August 10, 2017 at 8:06 am

    It’s not working dude

    Like

  2. 江伟
    November 12, 2017 at 3:18 pm

    It’s not working

    Like

  3. October 26, 2018 at 9:25 pm

    You are just using the wrong type of quotation marks there. It works great!

    Try:

    Like

  1. May 22, 2017 at 9:21 am

Leave a comment