How can I use deflated/gzipped content with an XHR onProgress function?

前端 未结 8 2366
醉酒成梦
醉酒成梦 2020-12-08 00:11

I\'ve seen a bunch of similar questions to this get asked before, but I haven\'t found one that describes my current problem exactly, so here goes:

I have a page whi

8条回答
  •  旧巷少年郎
    2020-12-08 01:07

    I do not clearly understand the issue, it should not happen since the decompression should done by the browser.

    You may try to move away from jQuery or hack jQuery because the $.ajax does not seems to work well with binary data:

    Ref: http://blog.vjeux.com/2011/javascript/jquery-binary-ajax.html

    You could try to do your own implementation of the ajax request See: https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Handling_binary_data

    You could try to uncompress the json the content by javascript (see resources in comments).

    * UPDATE 2 *

    the $.ajax function does not support the progress event handler or it is not part of the jQuery documentation (see comment below).

    here is a way to get this handler work but I never tried it myself: http://www.dave-bond.com/blog/2010/01/JQuery-ajax-progress-HMTL5/

    * UPDATE 3 *

    The solution use tierce third party library to extend (?) jQuery ajax functionnality, so my suggestion do not apply

提交回复
热议问题