lxieyang / chrome-extension-boilerplate-react

A Chrome Extensions boilerplate using React 18 and Webpack 5.
MIT License
3.42k stars 1.07k forks source link

How to read and write to/from DOM #163

Open mrfzd opened 1 year ago

mrfzd commented 1 year ago

First of all, thank you for this great boilerplate project! It's simply awesome and well put together! So thank you so much for the all efforts, time and the LOVE you have put into this so far!

So after fiddling around, I've been trying to figure out a way to read DOM elements (for any given website that I open up the the Chrome ext. popup)? Also, how could I highlight and inject elements into any given website i.e. google.com (via the popup)?

Thank you

AliBahaari commented 6 months ago

Any idea?

Toumash commented 2 months ago

You need to communicate popup with content script - use communication https://developer.chrome.com/docs/extensions/develop/concepts/messaging To run a script use executeScript or just normal content_script https://github.com/crxjs/chrome-extension-tools/issues/859