Skip to content

Commit

Permalink
Remove FF workaround
Browse files Browse the repository at this point in the history
Seems fixed in latest jquery release
  • Loading branch information
felixge committed Apr 6, 2013
1 parent e6504d4 commit 2109380
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions assets/js/upload-demo.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
$(function() {
'use strict';

fixFirefoxHeaders();

var host = window.tusdEndpoint || 'http://localhost:1080';
var $progress = $('.js_progress');
var $download = $('.js_download');
Expand Down Expand Up @@ -115,39 +113,4 @@ $(function() {
$download.show();
$download.text('Download '+data.files[0].name);
}

// This is required at the moment to get CORS headers support for Firefox.
// Based on http://bugs.jquery.com/ticket/10338#comment:13
function fixFirefoxHeaders() {
var _super = $.ajaxSettings.xhr;
$.ajaxSetup({
xhr: function() {
var xhr = _super();
var getAllResponseHeaders = xhr.getAllResponseHeaders;

xhr.getAllResponseHeaders = function() {
var allHeaders = getAllResponseHeaders.call(xhr);
if (allHeaders) {
return allHeaders;
}

allHeaders = "";
var concatHeader = function(i, headerName) {
if (xhr.getResponseHeader(headerName)) {
allHeaders += headerName + ": " + xhr.getResponseHeader(headerName) + "\n";
}
};

$(["Cache-Control", "Content-Language", "Content-Type", "Expires", "Last-Modified", "Pragma"]).each(concatHeader);

// non-simple headers (add more as required)
$(["Location", "Range", "Content-Range"]).each(concatHeader);

return allHeaders;
};

return xhr;
}
});
}
});

0 comments on commit 2109380

Please sign in to comment.