I'd like to get some data regarding stocks from :http://finance.yahoo.com/q?s=AAPL and i'm wondering if there is any way to accees the DOM of this page from my application. Let's say i have the this query: http://finance.yahoo.com/q?s=AAPL, i tried to access the DOM from the Chrome console : console.log (document.head.innerText), but o couldn't find a way to access it using my local script file.
Asked
Active
Viewed 42 times
2 Answers
1
You won't be able to access directly the content of that page from another page in Javascript, because of same-origin policy (given that your app is a website on another domain). The best way would be to write a backend working as a proxy and API for your app. Or maybe Yahoo finances already has a public API ;)

Antoine
- 5,504
- 5
- 33
- 54
-1
You can't access the DOM with cross domain. In other hand you can make a GET request with jQuery before exploit the DOM.

akoudoum
- 1
-
And then you hit the same origin policy and access is denied. – Quentin Aug 11 '14 at 15:21
-
If your provide an example it would be a much more useful answer. – Display Name is missing Aug 11 '14 at 15:29