I don’t know if it’s possible but what I want is creating some script that scans into a webpage that isn’t on my server and grab it’s sourcecode so I could use some data, like PERL or Rails scripting but with Jquery/Javascript
Is that possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the general case, no, it’s not possible from the client because of the Same Origin Policy, which prevents your loading and looking at the HTML and script source of content loaded from different origins. (You can, of course, do this with JavaScript on the server — NodeJS, Rhino, and similar.)
However, if the other domains support Cross-Origin Resource Sharing and the browser you’re using also supports it, that can allow the other end (the other website) to allow code from your origin (or all origins) to access it. The other end has to allow it, though.
You’ll also hear about JSON-P in this context, but that only allows you to get data (not HTML source and such) from the other end, and requires that the other end explicitly support it.
So you probably have to have a server involved. It doesn’t necessarily follow that it has to be your server, though: You can use YQL as a cross-domain proxy for some purposes.