2

I am trying to load a javascript file dynamically using jQuery.getScript in my Chrome App. The script file is also residing in my local application package directory. But unfortunately, it's giving this error:

Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-DwKWwwx2UjO8OY5zLIQ4qwwAhk2h3hAP48ROwlZJCNo='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

Is there any workaround to this?

codelearner
  • 1,354
  • 1
  • 16
  • 32
  • You should follow up the CSP for Chrome Apps here: https://developer.chrome.com/apps/contentSecurityPolicy – Dayton Wang Jun 15 '15 at 20:57
  • What sort of script do you want to load dynamically? Chrome Apps have to comply with a Content Security Policy that, among other things, disallows `eval()`-ing downloaded scripts. You might want to pre-package all of the scripts you need in your Chrome App. –  Jun 16 '15 at 01:57
  • I have the script locally in the package. I have also tried with setting CSP but no luck. Actually I need to dynamically change the locale and then include specific locale script. – codelearner Jun 16 '15 at 13:56
  • [Loading external javascript in google chrome extension](http://stackoverflow.com/a/8861191/453767) – Amit Kumar Gupta Dec 14 '16 at 16:50

0 Answers0