views:

467

answers:

1

According to https://developer.mozilla.org/en/HTTP_access_control#Requests_with_credentials, Firefox will only send credentials along with cross-domain posts if invocation.withCredentials = "true"; is set… But it doesn't seem like jQuery's Ajax API provides any mechanism for this.

Is there something I've missed? Is there some other way I can do it?

+4  A: 

You can use the beforeSend callback to set additional parameters (The XMLHTTPRequest object is passed to it as its only parameter).

Just so you know, this type of cross-domain request will not work in a normal site scenario and not with any other browser. I don't even know what security limitations FF 3.5 imposes as well, just so you don't beat your head against the wall for nothing:

$.ajax({
    url: 'http://bar.other',
    data: { whatever:'cool' },
    method: 'GET',
    beforeSend: function(xhr){
       xhr.withCredentials = true;
    });

One more thing to beware of, is that jQuery is setup to normalize browser differences. You may find that further limitations are imposed by the jQuery library that prohibit this type of functionality.

Doug Neiner
Awesome, thanks.
David Wolever