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.

 

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

    It’s not working dude

  1. May 22, 2017 at 9:21 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: