gzip编码与JSON兼容吗? [英] Is gzip encoding compatible with JSON?
问题描述
ob_start(ob_gzhandler);
适用于HTML。但是,在应用程序/ json数据中有什么问题吗?任何人都知道的任何浏览器问题?
我不这么认为...我使用静态文件存储之前使用过gzip压缩的JSON,并且它与AJAX工作正常。
编辑:我检查了我的PHP脚本,我唯一做的是包括这些标题:
内容编码:gzip
内容类型:text / plain
如果我记得正确,每当我尝试将Content-Type更改为表示JSON的内容时,客户端就有问题。 p>
I'm trying to narrow down some weirdness going on with my AJAX calls. My PHP scripts have this at the start:
ob_start("ob_gzhandler");
Works great with HTML. But are there any problems with doing it with application/json data? Any browser issues anyone is aware of?
I don't think so... I've used static files stored as gzipped JSON before, and it worked fine with AJAX.
edit: I checked my php script and the only thing special I did was to include these headers:
Content-Encoding: gzip
Content-Type: text/plain
If I remember right, whenever I tried to change the Content-Type to something that would indicate JSON, the client had trouble.
这篇关于gzip编码与JSON兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!