I have built a chrome extension which includes an Angular User Interface in a new tab started from the extensions context menu.
chrome.action.onClicked.addListener(async function () {
let ANGULAR_HTML_URL = "/dist/index.html";
chrome.tabs.create(
{url: chrome.runtime.getURL(ANGULAR_HTML_URL)});}});
This works already very well.
Now, I want to extend it to include an embedded youtube video. When launching the Angular page standalone (not as an extension) this work properly too. But this requires that the youtube iframe api (
https://www.youtube.com/iframe_api) is loaded. I tried several ways:
- adding a static script tag to the index.html
=> Fails with Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' - Loading dynamically by. creating a script tag. Which would likely lead to a violation anyway
=> Fails with Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' - Changing the Content Security Policy in the Manifest 3
=> Prevents extension from being loaded as this is not an allowed change
- Adding the url to the host permission
=> Does not change any of the behaviors above
So my question: What can I do to load this external script into my extension? Or is this simply not possible because extensions are so much restricted in the meanwhile that even valid usages of external scripts is not possible anymore. Even not if they origin from a Google service?