0

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.

Community
  • 1
  • 1
gdoug
  • 715
  • 1
  • 5
  • 16
  • Are you talking about AJAX requests only or all HTTP requests (images, styles, scripts, ajax, etc)? – GG. Apr 18 '16 at 19:59
  • Good question. I am trying to intercept all requests made from javascript scripts. Statically linked resources don't need to be intercepted, though they can be if it makes the problem easier. – gdoug Apr 18 '16 at 20:16

0 Answers0