0

I'm looking to make a chrome extension that would be able to access the redux store of an existing webpage. The Redux-Dev Tools extension can read the state from websites, but not in a way that would be accessible for my own chrome extension.

For example, let's say facebook.com stores the username in a Redux store. I'd like the chrome extension that I write to be able to access the username in the Facebook.com redux store. Is this possible in any way?

Thank you!

Tepinvic
  • 33
  • 4
  • If Redux-Dev Tools can do it then it's likely possible for your extension as well. For example React DevTools use a documented debugging hook in React itself. Use google search to find something along this approach. Or simply inspect the code of that extension, you know. – wOxxOm Oct 02 '19 at 19:48
  • Redux-Dev Tools requires you to add window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() to your store though. Suppose the site who's store I want to access (e.g. Facebook.com) has not added the redux dev tools. Would there be a way to access that store without modifying the source websites code/ – Tepinvic Oct 02 '19 at 21:05
  • Extensions can add a variable on `window` **in the page context** before the page scripts run, see [this answer](/a/9517879) and use method 2 + `"run_at":"document_start"` for your content script. – wOxxOm Oct 03 '19 at 06:21

1 Answers1

0

It is not possible that Redux-Dev Tools extension is always in the developer, but there are other ways. Suppose Redux works like JWT so the odds are very low

  • Correct that Redux-Dev-Tools may not always be available for a given webpage. That not withstanding, which other ways would you recommend? – Tepinvic Oct 02 '19 at 19:49
  • You can use with React hooks (useReducer) –  Oct 02 '19 at 20:44