I m trying to inject my custom script into first place in the head section using a content script.
It is able to inject my custom script into the main window document, and all other frames which have been loaded into DOM initially.
But whenever any new IFrame has been added into DOM, how should I add the custom script into the newly added Iframe.
For now what I m planning is to put the mutant observer into a content script which checks if any new IFrame has been added. if yes inject the custom script into Head of Iframe document.
Is there any better approach where the content script do this task by changing some configuration?
my current configuration for a content script is
"content_scripts": [
{
"js": [ "main.js" ],
"matches": [ "<all_urls>" ],
"all_frames": true,
"run_at": "document_start"
}
],