0

I have this line of code in contentscript.js file - Chrome extension: event.target.innerHTML = txt;

this line is not implementable on Facebook comment controls.

That is to say , I cannot change the text in the control (the comment field).

I am trying to correct a wrong text (gebberish) in a text fields. It works well on other places but not in Facebook comment fields.

The truth is , that this line "event.target.innerHTML = txt;" is performed well, and the content of 'txt' is set into the target control (a comment field which, in fact, is a <p> element of html - in Facebook), but, then, it turns back and the original text is displayed.

This very question was asked two years ago by a stackoverflow member named @mipsc here is the link.

As mipsc assumed there, there is a prevention set by Facebook which does not allow changes.

I cannot comment on mipsc question there because I do not have enough reputation level in stackoverflow.

So I try here to get information if there is a way to solve this, besides by getting a technical permition from Facebook.

  • I guess that facebook store the state of the field internally and changes it on key presses. You would have to mimic key press events. – Konrad Nov 05 '22 at 19:02
  • Use execCommand on `[contenteditable]` element as shown [here](https://stackoverflow.com/a/57900849). – wOxxOm Nov 05 '22 at 21:01

0 Answers0