1

I wrote a simple example in Python. the goal is to fetch the HTML and use "beautifulsoup"(html parser library) to parse the data I want. The tools I used as following 1. curl : to fetch specific url resource 2. beauifulsoup : make me parse the complex html more easier

Now, I want to achieve the goal by pure javascript, Because I want the to put the functionality on the my web site, however if put the computation tasks on Server side is heavy for server, so I want to pass the tasks to the client-side.

Is there any good way (some libraries?) to achieve the goal quickly?

Many thanks in advance

2
  • jQuery, Prototype, MooTools Commented Jul 21, 2013 at 4:29
  • You can use JsonP [this link may help][1] [1]: stackoverflow.com/questions/2921242/… Commented Jul 21, 2013 at 4:32

1 Answer 1

1

You cannot fetch HTML from other domains using JavaScript. It's intentionally disallowed for security reasons.

You could write a simple proxy on the server-side and then fetch the HTML through the proxy. That would free the server from any heavy computation you need to do, even if the load isn't completely on the browser.

Or, if you have control of the code on the other site, you could use JSONP as stated in Hilmi's comment.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.