Communication between react app and extension

95 views
Skip to first unread message

Soubhik Biswas

unread,
May 9, 2024, 4:41:52 PMMay 9
to Chromium Extensions
hello , can  help me please

I have a Chrome extension. I need the functionality where, when I send a 'start' event from a React app (created by Vite TypeScript), the extension's popup will display 'activated'. Similarly, when I send a 'stop' signal, it will show 'deactivated'.

Patrick Kettner

unread,
May 16, 2024, 10:33:35 AMMay 16
to Soubhik Biswas, Chromium Extensions
Hi Soubhik!

You can use chrome.runtime.sendMessage to send a message from a website to your extension. 

On Thu, May 9, 2024 at 4:41 PM Soubhik Biswas <sou...@soulhq.ai> wrote:
hello , can  help me please

I have a Chrome extension. I need the functionality where, when I send a 'start' event from a React app (created by Vite TypeScript), the extension's popup will display 'activated'. Similarly, when I send a 'stop' signal, it will show 'deactivated'.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/a87d4e56-d9bd-4df3-bfd0-ae9fd8544b5fn%40chromium.org.

wOxxOm

unread,
May 16, 2024, 2:57:59 PMMay 16
to Chromium Extensions, Patrick Kettner, Chromium Extensions, Soubhik Biswas
You'll need to declare externally_connectable, see https://developer.chrome.com/docs/extensions/mv3/messaging/#external-webpage

Rajat Paharia

unread,
May 17, 2024, 9:21:26 AMMay 17
to Chromium Extensions, wOxxOm, Patrick Kettner, Chromium Extensions, Soubhik Biswas
I actually just implemented this in my extension, and it's a very cool capability

My use case: 
  • I had a number of onboarding components I wanted to add to various pages on the web (Google Sheets, LinkedIn, etc.)
  • But since a lot of people weren't reading the onboarding pages, they would see my components on those pages and wonder what was happening
  • Using this capability, I was able to add a button to my onboarding pages that calls into my extension and adds the components
  • And then when the user is done with onboarding, another button that deletes them. 
It really opens up a lot of possibilities! - rajat
Reply all
Reply to author
Forward
0 new messages