I'm aware that you are able to load external domains in iFrames in Chrome Extensions by specifying their permissions in the manifest, and using content_scripts with all_frames to inject your own code.
However, I am now using optional_permissions to avoid user prompts on install, and opted to instead prompt when the user actual needs said permission. The idea is to load a content script inside an iFrame of specific pages. What I did before was run the content script on all pages, but use a #hash to specify when to run frame specific code.
Now that I only use optional_permissions, how do I go about actually getting the script to run inside the iFrame?
Basically I want something like this in my main window.
on userAction {
loadFrame(externalURL); // This I can do just fine.
loadContentScriptinFrame(); // How do I do this?
}
Or is there some manifest trickery that works with a combination of content_scripts
, optional_permissions
, all_frames
, and if(frame){doStuff()}
?