Renasue
PD🧩 Plasmo Developers
•Created by Renasue on 3/28/2025 in #🔰newbie
Best way to send a message from popup to content and get a response in Plasmo?
I decided to define
chrome.runtime.onMessage.addListener
in the content script and use chrome.tabs.sendMessage
to send messages. It always responds with the result from the content script to the popup.
Previously, I created the extension using pure JavaScript without any framework. Now, I’m trying to use Plasmo, but I’ve encountered this issue.
I resolved the issue, and it now works as expected. However, I have a question: why doesn’t Plasmo support this by default?
My Solution
content/plasmo.ts
popup.tsx
Custom send message function:
5 replies