load document object for different page
A preface: I'm new to javascript and trying to create a web visualization using开发者_开发问答 html5 canvas.
Using the document object I can traverse the DOM of the page that my script is embedded in, but if I want to access the DOM of another page how would I go about that?
I searched around quite a bit but couldn't find anything. Being new to javascript I am somewhat unsure of what to search/where to begin, which is why I posted here. Thanks!
The easiest way to load another page in a fashion that would allow you to access its DOM would be to use an iframe. This would, however, be subject to the same origin policy.
If you want a cross domain solution, you would probably be better off using a server side process to request the document, parsing it there, and then presenting the data you care about as JSON to the client.
精彩评论