I am studying javascript and I’ve got some problems. I would like to save the source of a page (html, json, xml) in a javascript variable. I didn’t find much surfing on the net so could you help me? Actually the page is on an external domain so how can I get around the same origin policy limitation?
Share
I do not believe you can pull the entire source code from an external domain without a server-side script such as PHP. The only cross-domain compatible format is JSONP, which with JQuery would require a JSON response from the other server. Both may pose a security risk to your webpage.
UPDATE:
See here for more information.