I am writing a small web service that takes in a URL for a web page and loads it on another domain, after adding some content.
One major problem one runs into when doing this is the use of relative URLs, especially so in javascript land. If a request is made in javascript using a relative URL, the url will reference the new domain, not the old one.
Is it possible to intercept HTTP requests in javascript to change the URL to which the request is sent?
I've looked at the info in this question but this seems to execute in unexpected ways.