Reputation: 6485
I'm using the following piece of code to pull a stock price from yahoo finance
<script type="text/javascript">
$(function() {
$("#quote").load("http://finance.yahoo.com/q?s=utg #yfs_l10_utg").text();
});
</script>
I get the following errors:-
Security Error: Content at file:[file url] may not load data from http://finance.yahoo.com/q?s=utg.
and
Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "[file url]"]
Source File: [url]
anybody have any thoughts as to how i might get around this?
Upvotes: 0
Views: 1063
Reputation: 4942
I know this does not help your case but putting it here for any future users that stumble upon this.
If you have access to the target URL service your calling, in PHP you can add the below code snippet to avoid this error.
header('Access-Control-Allow-Origin: *');
Upvotes: 0
Reputation: 78677
See this which details how to use YQL to get jsonp results back from yahoo services
Upvotes: 0
Reputation: 1097
The JavaScript security model doesn't allow you to load off-domain content. There's a good explanation of this and some work-arounds on the jQuery .getJSON docs: http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback
Upvotes: 1