Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Internet Explorer doesn't send Accept header #654

Closed
nnarhinen opened this issue Sep 28, 2011 · 8 comments
Closed

Internet Explorer doesn't send Accept header #654

nnarhinen opened this issue Sep 28, 2011 · 8 comments

Comments

@nnarhinen
Copy link

Internet Explorer isn't sending the Accept header correctly, it sends: /

reproduce code

$('#fe-discountfile').fileupload({
  type: 'PUT',
  dataType: 'json',
  url: $('#fe-discountfile').closest('form').attr('action'),
  done: function (e, data) {
    alert(data.result.rows[0].name);
  }
});
@nnarhinen
Copy link
Author

Oh, github strips input..

it sends the header as /

@nnarhinen
Copy link
Author

And btw I'm using Internet Explorer 9

@blueimp
Copy link
Owner

blueimp commented Sep 28, 2011

File Uploads with IE are done using the iframe transport.
The iframe transport is a simple HTML form based upload with an iframe target.
Therefore it doesn't support PUT uploads and also doesn't support modifying any headers.

@nnarhinen
Copy link
Author

I don't think this is the case. IE9 seems to be using XHR and PUT method. The accept header handling just differs. So maybe this should be fixed properly (by adding full xhr support for IE9) or then force iframe uploads for IE9..

@blueimp
Copy link
Owner

blueimp commented Sep 28, 2011

No released version of IE supports XHR file uploads.
The plugin doesn't check for browser types or versions, but rather tests capabilities and falls back to the iframe transport if XHR file uploads are not supported:
https://github.com/blueimp/jQuery-File-Upload/blob/master/jquery.fileupload.js#L145

Did you include the iframe transport library?

@nnarhinen
Copy link
Author

OK,
so forget about the test case I wrote. I didn't test it properly.

Yeah I didn't include the iframe transport library because I don't want the iframe upload. Then why is IE uploading with PUT if XHR isn't supported?

here's a snippet from access.log

"PUT /products/discounts HTTP/1.1" 500 20 "http://myservice.com/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"

So IE9 definitely is PUTting atleast.

@blueimp
Copy link
Owner

blueimp commented Sep 29, 2011

Yeah I didn't include the iframe transport library because I don't want the iframe upload. Then why is IE uploading with PUT if XHR isn't supported?

The iframe transport is enabled simply by adding 'iframe ' in front of the jQuery ajax dataType option:
https://github.com/blueimp/jQuery-File-Upload/blob/master/jquery.fileupload.js#L268

If no iframe transport has been registered, jQuery will fall back to using XHR as transport, but without actually uploading any files.

To prevent these useless XHR uploads, you can return false in the send callback when the dataType option contains "iframe":

$('#fileupload').bind('fileuploadsend', function (e, data) {
    if (data.dataType.indexOf('iframe') !== -1) {
        return false;
    }
});

@blueimp blueimp closed this as completed Sep 6, 2012
@chronossc
Copy link

How is that IE error today? I getting 403 on Django because I do not send some headers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants