Transparent JavaScript Blob Decompression

Modern browsers can handle deflated / gzip 'd data sent by the web server. For example, you can configure Apache to deliver gzip compressed XML files if the browser supports it.

I am trying to use this feature with Blob s.

I have a JavaScript program that creates a Blob from compressed data embedded in a JS file and then uses XMLHttpRequest to load the data from the generated URL blob:

.

However, no matter what content type I specify when creating the Blob, for example application/octet-stream;deflate

or application/octet-stream;gzip

, the browser does not use decompression. I've tried several content types but to no avail. The browser seems to be ignoring the encoding specified in the content type string.

Is it possible to load a resource blob:

and does it automatically unpack / inflate the browser in the same way as if it were loaded from http:

, i.e. a web server?

+3


source to share





All Articles