Inject Content Security Policy in <webview>?


#1

My question is in the title. Is there a way to inject custom CSP rules to a <webview>? Here is the code I have, attempting to achieve this:

document.addEventListener("load", function () {
  var headContent = document.getElementsByTagName("head")[0].innerHTML;

  headContent.prepend(
    "<meta http-equiv=\"Content-Security-Policy\" content=\"script-src 'self' 'unsafe-inline';\">"
  );
});

Unfortunately, this doesn’t seem to be working.