且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

gzip压缩的JSON文件不DECOM pressing

更新时间:2023-11-10 08:58:28

浏览器不会自动DECOM preSS只是任何COM pressed数据跨它们运行。服务器有告诉流只有COM pressed运输浏览器和它需要DECOM pressed处理(否则你将无法在下载和保存COM pressed档案之前所有!)你需要让你的Web服务器发送合适的标题(内容编码),但是做检查浏览器支持COM pression首先这样做(在Accept-Encoding头之前)。大多数网络服务器也可以gzip压缩动态的东西给你,除非这是太大的性能损失。

Browsers don't automatically decompress just any compressed data they run across. The server has to tell the browser that the stream is only compressed for transport and it needs to be decompressed before processing (otherwise you wouldn't be able to download and save compressed archives at all!) You need to make your web server send the appropriate headers (Content-Encoding), but do check that the browser supports compression in the first place before doing that (the Accept-Encoding header). Most webservers can also gzip things for you on the fly, unless that's too big of a performance hit.

不知怎的,我有你将有更多的麻烦解析的感觉,很多JSON的浏览器不是检索它...

Somehow I have the feeling you're going to have more trouble parsing that much JSON on the browser than retrieving it...