Optionally inject contentscript in iframes
vitonsky opened this issue · 4 comments
Optionally inject contentscript in iframes
It useful for tweets and other widgets on page
It may be enable by default
Manifest option "all_frames": true
It require method to detect main CS and CS in iframe for same tab.
Primary must execute commands, and sub scripts must only listen and obey.
Also it require synchronization of singleton instances like button for translate selected text which should be shown only in one place - main page or iframe.
p.s. Use match_about_blank
for blank iframes: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_scripts
If we will enable this feature, we have to:
- Listen events for each contentscript instance on tab
- Calculate one state for all instances, to send responses on requests (like popup requests "what's page translation state?", "what's page language?")
- Exchange data between instances
We have to try find another way, like explore iframe as DOM node if possible, to keep only one contentscript instance
It would be really nice to be able to translate pages in iframes too. Probably easier to explore the iframes as DOM nodes yes