I'm first off very bad at java. If it were PHP or any other object-oriented language I'd be fine. That said, I really would appreciate it if someone could help me come up with a javascript that will dynamically rewrite only the external links on every page I put the java into the header of. This is so I can redirect them to a redirector, in order to use an iframe script I have to try and get them to return to my site. Any chance someone could help a guy out with this? I really couldn't find it through google or hotscripts, otherwise I wouldn't be asking. (And I'd write it if I could, but I just never have been able to handle java as well as php or c, or even bash...lol).
Java & JavaScript Are Two Very Different Things, JavaScript Is Actually Similar To PHP; So If You Know PHP You Should Be Fine
Yep, the only thing Java and javascript have in common is just the name. About the second part - javascript is not at all similar to PHP. Whatever.. this isn't the point. Generally, to do what you want you can use document.getElementsByTagName() . Get all <a> elements on the page and then rewrite their href attribute.
You could just as well do this in a PHP-function - for instance, check all HREF-attribures, and if they're not part of your domain (ie. external links) rewrite the links to whatever you want. Shouldn't be too hard implementing a parsing function with str_replace or preg_replace for whatever content you show on your website. This would also mean that it would work regardless of whether the user have javascript turned on or not.