0

I am trying to load a website into JavaScript so I can scrape it. My question is how would i load the website into client side JavaScript? I have tried loading it into a iframe and a JavaScript object element.

1 Answer 1

2

You'd use AJAX. In most cases, though, the same-origin policy will trip you up - JavaScript on example.com can't access the source code of example.net because they're different domains.

If both sites are under your control, CORS can fix this. If you're trying to scrape something like Facebook, you'd have to proxy the requests with some sort of server-side language like PHP.

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.