How can I load a relative url from a different domain?
Hi there,
I am trying to scrape news links from other sites on our company's intranet, but the urls on the source page are not absolute urls and so don't link to the correct location when they are scraped from a different domain.
Example
Assume my News Desk page is located at
http://site1.net/news_desk.htm
In this page I'm using the following jQuery to scrape another site which has a different domain name:
-
$("#LatestNews").load("http://site2.net/news/top_stories.asp .news li:lt(3)");
This results in the following being pulled into news_desk.htm page:
-
<li><a href="/news/articles/story1.asp">Story 1</a> (16 Feb)</li>
<li><a href="/news/articles/story2.asp">Story 2</a> (16 Feb)</li>
<li><a href="../articles/story3.asp">Story 3</a> (16 Feb)</li>
The problem is that these links no longer work when they are clicked on from my news desk page in
http://site1.net because the articles are in
http://site2.net. Is there a way to get the absolute url when I load them? Or is there a way to get around this problem?
Many thanks,
Katie