Load a resource using XHR with response header Content-Encoding: gzip
and Content-Type: application/x-tar
is not uncompressed.
var xhr = new XMLHttpRequest();
xhr.open("GET", "/test.tar", true);
xhr.addEventListener("load", function (event) {
/*
Note: Non printable chars in content body are replaced by replacement char �
Response from the server:
````
HTTP/1.1 200 OK
Content-Length: 114
Content-Type: application/x-tar
Content-Encoding: gzip
�ã��������Ì—=���Ä0��‡�%'ê¥∂Èy�⁄≠ãç‡Òç?8vS�Û-è¿��"π…�´¿ÉààC¿=�«#…üÛ%†Û…Ûò�EF“Å"�¡�ñ&”¨´‘\[ØßµR˙G*ºÛ#Dˇ�∆�c~g�Ãw‘æ����
````
xhr.responseText contains (or xhr.response, if xhr.responseType = "arraybuffer" is used):
"�ã��������Ì—=���Ä0��‡�%'ê¥∂Èy�⁄≠ãç‡Òç?8vS�Û-è¿��"π…�´¿ÉààC¿=�«#…üÛ%†Û…Ûò�EF“Å"�¡�ñ&”¨´‘\[ØßµR˙G*ºÛ#Dˇ�∆�c~g�Ãw‘æ����"
instead of
"test.txt 000644 000765 000024 00000000004 12726371056 012705 0 "... (160 first bytes)
*/
});
xhr.send(null);
Workaround: serve the resource with an other media type, like application/octet-stream
- xhr
- ✅ IE 11