user1019083
user1019083

Reputation: 381

extracting source code of a webpage

Hi I wanted to extract the source code of an external website (not on my domain) and then parse it to make it an application. I know how to do it using Jsoup library for JAVA, but I was not able to find any links on how to do it using Javascript or Jquery or any client side web programming language. Can someone guide me on which library should I use. Basically, I want to get the HTML source code of a webpage and then parse it to extract certain links under certain tags.

Upvotes: 1

Views: 583

Answers (1)

epascarello
epascarello

Reputation: 207557

You will not be able to do this with JavaScript alone because of same origin policy. That prevents you from reading information from other domains.

What you would have to do is use a serverside proxy to fetch the information. An Ajax call can call the proxy to fetch the page.

Upvotes: 4

Related Questions