0

I need to make an ajax request, IE Works OK, Firefox URI DENIED.

I googled and I found the the only way is to use JSON to eliminate and restrictions.

Is there some one got any example?

Thanks

1
  • is your URI pointing on the same server as the page in which the code appears? Commented Apr 6, 2009 at 13:27

5 Answers 5

2

With jQuery it could look like this:

$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?" +
          "tags=cat&tagmode=any&format=json&jsoncallback=?",
    function(data){
      $.each(data.items, function(i,item){
        $("<img/>").attr("src", item.media.m).appendTo("#images");
        if ( i == 3 ) return false;
      });
    });
2
  • Are you sure this would work? Because I believe it won't due to same origin policy restrictions. Commented Apr 6, 2009 at 12:46
  • it will work because this is a jsonp request, and you know this because you see the ? in the url. see jquery's jsonp documentation for more info.
    – mkoryak
    Commented Apr 6, 2009 at 13:30
0

Alternatively, you can make your XMLHttpRequest specify your user-agent as IE (browser sniffing is stupid):

var req = new XMLHttpRequest();
req.setRequestHeader('User-Agent','MSIE 7.0');
req.open("GET", sURL, true);
req.onreadystatechange=function() {
    if (req.readyState==4) {
        alert(req.responseText);
    }
}
req.send(null);

Or better yet, send a strongly worded e-mail to the site admin about their not accepting requests from non-IE browsers. In this day and age, building an IE-only site is unacceptable. It undermines the accessibility & usefulness of the web in so many ways.

0

Before you get in too deep, try using an absolute url in the request. The only difference I know of between IE and FIrefox that would apply here is that IE converts relative urls to absolute in http traffic.

0

You can always use a serverside proxy.

0

If this is a cross-site issue (I don't think it is), try setting up a subdomain for your site (say, flickrapi.acme.com) that is a CNAME to api.flickr.com.

Not the answer you're looking for? Browse other questions tagged or ask your own question.