Hacker News new | ask | show | jobs
by libertymcateer 3192 days ago
How did you deal with text injection into react forms on facebook?

Whenever I interact with text in a form field on facebook via a browser extension, it is not picked up by react, and the original text is what is picked up on submission. I've banged my head into this problem repeatedly. Is there an easy fix or is this something much more subtle?

2 comments

If i recall correctly, just look for DOM changes. The code is all open, so you can look at it.

https://github.com/lettergram/AnyCrypt/

I mean on the encrypt side, not the decrypt side. When I try to put text into a react form, react doesn't pick it up - it still uses the original text in the input form. I will definitely look at that code though, thanks!
I won't pretend to be an expert, but very vaguely, if I know anything about react: you would have to modify the local state of the form (if it's possible at all by a 3rd party in fb frontend code) and react/flux will modify the dom for you. If you go more directly (on the DOM for example) you will get overwritten by the current state as soon as react re-renders
Forgive the million questions - is this not what you are doing on facebook? Or is it only working on facebook chat? Is that not react?

Sorry to be such a pest but I've spent probably too much time banging my head against this problem. Thanks!

sorry I'm not @lettergram, so I cannot really help you with his code; I never tried to inject code into a facebook page, but I can imagine that especially after minification it's going to be a pain to do