سؤال

I'm trying to create web-scraping functionality for my GWT app. This involves making HTTP requests from the client, which violates SOP. You can circumvent this by using JSONP, if the other domain is sending JSONP responses. I'm wanting to make a request to www.google.com (for example) and scrap the html. What I'm wondering is this: Is there a way to wrap a GET request to an html-serving domain in JSONP? This way I would be able to make requests without using a proxy server.

Note: If anyone is wondering why I can't use a proxy server it's because I want this to be a completely client-side app, eventually to become a phonegap app.

From what I have read, there is no way to do this without adding some server-side code, is this true?

هل كانت مفيدة؟

المحلول

If I understood right, you want to retrieve other content-type than JSON through a JSONP request.

Well, I don't know of existing solutions for this case. JSONP relies on script element injection, forcing your retrieved data to be javascript (http://en.wikipedia.org/wiki/JSONP#Script_element_injection).

Additional references:
Use JSONP to load an html page
Using JSONP when returning XML

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top