Possible Duplicate:
Is it possible to force jQuery to make AJAX calls for URLs with gzip/deflate enabled?
I’m going across two different domains with jsonp. Domain1 asks Domain2 for some json data using $.getJSON with a callback parameter and that works great, no problems there.
Domain2 can also serve the json data gzipped.
I’d like to utilize this feature but I don’t know how to request it from Domain1 using jQuery’s $.getJSON.
Is this possible and if so can you please give me an example (or any other workaround).
Thanks!
gzipping your http traffic is a server option that is transparent to the actual processes that work with the content (your script in your case). The browser takes care of the gzipping, but it will only work if both sides of the connection support it (this is communicated in the request header). Also you must enable it server side (for instance use mod_deflate in apache)
You state that the server on domain2 supports gzipping, so if you configured it correctly all traffic that is “gzippable” will get gzipped automatically. No extra work on your part is necessary.
If you want to know if yrou traffic gets gzipped take a look at the response headers of your jsonp call. They should say that gzip is used. You can do this in chrome for instance.