E_Blue
E_Blue

Reputation: 1151

Greasemonkey simple html text replacing not working

I need to replace all the olds links of an HTML page by the new web page so I created the following script

document.body.innerHTML.replace('www.forumoldpage','www.forumnewpage');

Save it but when I open the web page do nothing.

There's something wrong with the code or do I forgot something to do?

Upvotes: 0

Views: 7021

Answers (1)

Tobi Schlüter
Tobi Schlüter

Reputation: 76

I was led to this question when trying to create my very first greasemonkey script, so I thought it's for the benefit of everybody if this question has an answer. Try this:

document.body.innerHTML = document.body.innerHTML.replace('www.forumoldpage','www.forumnewpage');

replace gives you a new string with the replacement effected, but you still have to replace the contents of the web page.

Upvotes: 5

Related Questions