Skip to content
Advertisement

Refused to load the script because it violates the following Content Security Policy directive

When I tried to deploy my app onto devices with Android system above 5.0.0 (Lollipop), I kept getting these kind of error messages:

07-03 18:39:21.621: D/SystemWebChromeClient(9132): file:///android_asset/www/index.html: Line 0 : Refused to load the script ‘http://xxxxx’ because it violates the following Content Security Policy directive: “script-src ‘self’ ‘unsafe-eval’ ‘unsafe-inline'”. 07-03 18:39:21.621: I/chromium(9132): [INFO:CONSOLE(0)] “Refused to load the script ‘http://xxx’ because it violates the following Content Security Policy directive: “script-src ‘self’ ‘unsafe-eval’ ‘unsafe-inline'”.

However, if I deployed it to mobile device with Android system of 4.4.x (KitKat), the security policy works with the default ones:

JavaScript

Then I thought, maybe, I should change to something like this:

JavaScript

Basically, both options don’t work for for me. How can I solve this issue?

Advertisement

Answer

It was solved with:

JavaScript
Advertisement