Execute code in the main world from a side panel #1515
Unanswered
stevebeauge
asked this question in
Q&A
Replies: 1 comment 3 replies
-
You can send a message to the background, then use the scripting API to run a script in the active tab. This would consume less resources compared to always injecting a content script (and keeping it idle until it receives a message). |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I want to execute some arbitrary code in the main world, triggered by a button in a side panel. My goal is to call API in a specific app using the user's context without having to reauthenticate.
As far as I understand, the only way o achieve this is:
Basically, using @webext-core/messaging, I've done:
I wonder if I missed something. Is there any simpler way to reach my goal?
As a side note I'll probably reuse the logic to implement an actual DevTool. Should I keep my structure ? are there better way ?
PS: thanks for the awesome work for this project!
Beta Was this translation helpful? Give feedback.
All reactions