Replacing links detected in a HTML with other links using JS
- by Jim
Hi people.
I'm having a bit of trouble figuring out how to do this one.
Here's the scenario. My e-commerce site has a blog with a lot of content, promoting the products I sell, reviewing them etc. 99% of the posts on the blog link back to the products they are talking about.
I'm going to be changing the URL where my ecommerce system is located. Therefore my blog is going to end up sending people to a lot of 404 pages.
The idea I've had is to be able inclue a JS file which will on load, scan the document for existing links then, if found, swap them out with ones which are now correct.
I hope this make sense.
Cheers,
Jim