I am trying to replace words on google chrome but have run into an issue. I am able to successfully replace specific words but it kills associated html links.
How can I keep links live and still replace text?
This is the code in my chrome extension content scripts:
wordDict = {"the":"piano","and":"Hello", "a":"huh?"};
for (word in wordDict) {
document.body.innerHTML = document.body.innerHTML.replace(
new RegExp('\\b' + word + '\\b',"gi"), wordDict[word]
);
};