I am trying to write a JavaScript program without using jQuery to replace all visible target text on a web page without breaking the functionality of the page.
In particular, I'm trying to make a Chrome extension that does this passively on sites like Facebook.
I experienced limited success with the following:
checkLoad(); function checkLoad(){ if (document.readyState === "complete") { document.body.innerHTML = document.body.innerHTML.replace("target string", "replacement string"); } else { setTimeout('checkLoad();', 500) } }
This code skips things like names of people, names, etc.
I looked around and can not find a working solution. Any ideas?
source share