1

My extension's content script:

let s = document.createElement("script");
s.setAttribute("async", "");
s.setAttribute("type", "module");
s.setAttribute("src", "https://gamergirlandco.github.io/some_script.js");
s.setAttribute("crossorigin", "anonymous")
document.body.appendChild(s)

However, I get this error:

WebExtension content scripts may only load modules with moz-extension URLs and not: “https://gamergirlandco.github.io/some_script.js”.

I've tried adding *://gamergirlandco.github.io/* to the permissions array in manifest.json, but that didn't work.

Help?

The Tablet
  • 11
  • 1
  • 4
  • You need to create this script element in [page context](/a/9517879). In Firefox this can be also done via `wrappedJSObject`. – wOxxOm Jul 13 '21 at 17:36

1 Answers1

0
  • The injection of script will be subject to the webpage's CSP (Content Security Policy) which means it might not be allowed by the webpage
  • Permission needed for the webpage/site that you are trying to inject the script into
erosman
  • 7,094
  • 7
  • 27
  • 46