I'm migration my extension from V2 to V3. Now all is working fine except for one thing. In my V2 version I did
const actualCode = '(' + function () { 'console.log("demo");' } + `)();`;
const script = document.createElement('script');
script.textContent = actualCode;
(document.head || document.documentElement).appendChild(script);
script.remove();
Note that the console.log("demo")
is a simplification of what I need to inject :)
I need to inject some javascript for my chrome-extension-magic to take place.
Now, in V3 this doesn't work anymore. I get the following error in my devtools-console
content.js:23114
Refused to execute inline script because it violates the following
ContentSecurity Policy directive: "script-src 'self'". Either the
'unsafe-inline' keyword, a hash ('sha256-tN52+5...6d2I/Szq8='), or a nonce
('nonce-...') is required to enable inline execution.
In the migration guide I noticed this section
"content_security_policy": {
"extension_pages": "...",
"sandbox": "..."
}
but there is not much description there, so this is magic to me. So I hope someone know can help me with this?