Has anyone here built a browser extension?

0
16
Asked By CreativeCactus92 On

I'm trying to build a browser extension and I need some help. I'm looking for a way to make my service worker utilize functions from a website. When I try to do something like `document.querySelector("foo").bar.doFunction()`, it works in my Chrome browser at the top level, but I can't seem to get it to work with my service worker. Any advice?

3 Answers

Answered By DebuggingNinja47 On

You might want to explore extension message passing. Setting up a message event listener in your service worker and sending messages from your content script could help with the communication you're looking for.

Answered By CodeWhizKid83 On

It sounds like you're at a tricky stage. I recommend checking out some tutorials to get a solid grasp on the basics. Chrome and Mozilla have some great resources that could help you along the way.

Answered By DevGuru88 On

I've got a simple example of browser extension communication that might help you out. Check it out here: https://github.com/molvqingtai/comctx/tree/master/examples/browser-extension. It could clarify how to structure your code!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.