How send message from background to content script UI
My background.js
And in the content/panel.js
I think there is no issue with permission. I have given the permission below:
"permissions": [
"tabs",
"activeTab"
]
After doing this the extension throws me an error.
Whats the problem with my code? Please explain if you know
10 Replies
did you try taking the onmessage handler out of useeffect?
@louis can you help me with this?
does your content script run in the main world?
No
@Asif if you want to send data from bgsw to csui, you must do a handshake first via the port protocol. If you want to do it at onUpdated, the csui will not be available at that time.
Generally, it's not advisable to send data from bgsw -> csui, since csui is considered short-lived and its life cycle is not owned by you.
Can you give me a simple code example of the current scenario?
It cannot be simple since the nature of what you're trying to do is complex :d...
Thanks. One more question. MAIN world is necessary to acheive pub/sub?
Gave +1 Rep to @louis (current:
#1
- 166
)