Javascript – Access to restricted URI denied code: 1012


How do you get around this Ajax cross site scripting problem on FireFox 3?

Best Answer

If you're using jQuery it has a callback function to overcome this:

As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: "myurl?callback=?". jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. Or, if you set the dataType to "jsonp" a callback will be automatically added to your Ajax request.

Alternatively you could make your ajax request to a server-side script which does the cross-domain call for you, then passes the data back to your script