How can you replace a link's target in Greasemonkey?
Posted
by Derek
on Stack Overflow
See other posts from Stack Overflow
or by Derek
Published on 2010-04-20T21:05:07Z
Indexed on
2010/04/20
21:23 UTC
Read the original article
Hit count: 346
greasemonkey
|JavaScript
I'm trying to write a script in Greasemonkey that will replace a link's target with something else, but with my limited Javascript knowledge I don't really know how to do this.
Basically I'm trying to find all links containing a certain string of characters (ex: //a[contains(@href, 'xx')] ), and either replace them with another link, or append something to them (replacing 'abc123.com' with 'zyx987.com' or 'abc123.com' with 'abc123.com/folder').
If you could point me on the right path I'd greatly appreciate it.
© Stack Overflow or respective owner