Sunday, April 8, 2012

Access to restricted URI denied code: 1012

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

Source: Tips4all


  1. 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

  2. Some more details would be nice: which AJAX library are you using, what would you like to achive, how you do it.

    For example it can be a cross-domain Ajax request, which is not allowed. In this case use JSON.