0

I have loaded jQuery via the manifest.json and I now want he ability to dynamically load other local scripts (if needed).

I have tried the following

$.getScript(chrome.extension.getURL('script.js'), function () {
    console.log("Script loaded")
});

But it gives this error

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-JNPQ...'), or a nonce ('nonce-...') is required to enable inline execution.

How can I fulfill what it asks for?

Rich93
  • 11
  • 2
  • jQuery `getScript` function will inline the local script which is prohibited. Refer to this: http://stackoverflow.com/questions/690781/debugging-scripts-added-via-jquery-getscript-function. You will need to do something like this: `` as answered in here: http://stackoverflow.com/questions/16145522/chrome-showing-error-as-refused-to-execute-inline-script-because-of-content-sec – Kafo Nov 27 '16 at 23:15
  • But will embedding the script in the DOM work for a background script? – Rich93 Nov 27 '16 at 23:17
  • Give it a try and see else you can embed using other ways without inlining – Kafo Nov 27 '16 at 23:19

0 Answers0