0

I created an AJAX XD request, the call done well, in Chrome everything works well and in response I can get HTTP headers, but in Firefox, I can't. I already have all origin headers declared and so on.

Can someone help?

    $.ajax({
                        url: 'myurl',
                        type: "POST",
                        cache: false,
                        dataType: "text",
                        crossDomain: true,
                        async: true,
                        xhrFields: {
                            withCredentials: false
                        }
                    })
                    .done(function( value, type, obj ) {
                    console.log('success', arguments, obj.getAllResponseHeaders());
                    });

On server it's defined the headers:
   header('Access-Control-Allow-Credentials: true');
   header('Access-Control-Allow-Origin: _URL_');
   header('Access-Control-Expose-Headers: some_id,Content-Range');
Mike Marks
  • 10,017
  • 17
  • 69
  • 128
Rfps
  • 36
  • 3

1 Answers1

0

This may be due to a bug in Firefox. There is a problem description and workaround suggestion in the jQuery documentation:

http://api.jquery.com/jQuery.ajax/

At present, due to a bug in Firefox where .getAllResponseHeaders() returns the empty string although .getResponseHeader('Content-Type') returns a non-empty string, automatically decoding JSON CORS responses in Firefox with jQuery is not supported.

johusman
  • 3,472
  • 1
  • 17
  • 11