Juno
Juno

Reputation: 83

Cordova, Content-Security-Policy: within iframe getting error as deviceready has not fired after 5 seconds

i recently upgraded my Cordova application from 2.9.0 to current version 5.4, since all know there is huge difference in project structure from cordova 2.9 to 5.4 i followed several online tutorials and upgrade my app.

And i'm able to get the app working. In my application i have maps feature and i'm loading maps in iframs in main html pages my deviceready event is being triggerd and i have no issue. but when i load iframe content i see

deviceready has not fired after 5 seconds. cordova.js:1176 Channel not fired: onFileSystemPathsReady maps.googleapis.com/maps-api-v3/api/js/23/2/util.js:30 Google Maps API warning: SensorNotRequired: https://developers.google.com/maps/documentation/javascript/error-messages

in chrome console (using chrome://inspect). I have already tried all solution discussed here but no luck.

i have added follwing line in may index.html

<meta http-equiv="Content-Security-Policy" content="default-src 'self' *;script-src 'self' 'unsafe-inline' 'unsafe-eval' *;style-src 'self' 'unsafe-inline' 'unsafe-eval' *;frame-src 'self' *">

and then i load iframe in index.html and my iframe has following

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

is there anything i need to configure or am missing. I have limited knowledge regarding latest cordova updates.

any help is really appreciated. Thanks

Upvotes: 2

Views: 545

Answers (1)

Juno
Juno

Reputation: 83

finally i fixed it this way. My issue was within iframe deviceready event was not being fired due to which i always got

deviceready has not fired after 5 seconds. cordova.js:1176 Channel not fired: onFileSystemPathsReady maps.googleapis.com/maps-api-v3/api/js/23/2/util.js:30 Google Maps API warning: SensorNotRequired: https://developers.google.com/maps/documentation/javascript/error-messages

and my other javascript features were breaking so i just simply removed the cordova.js withing my iframe and then i access all cordova utils from the parent page useing parent.window Hope this may help someone too.

Upvotes: 2

Related Questions