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
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.