0

can anybody explain the process. I am totally confused. NO idea of how to get this compression and decompression. Detail guide will be appreciated, However please leave your thoughts and suggestion which are useful.

divakar
  • 1,379
  • 6
  • 15
  • 31
  • possible duplicate of [Is it possible to force jQuery to make AJAX calls for URLs with gzip/deflate enabled?](http://stackoverflow.com/questions/3778706/is-it-possible-to-force-jquery-to-make-ajax-calls-for-urls-with-gzip-deflate-ena) – Lee Gary Oct 03 '14 at 09:48
  • 1
    NO i am asking what is gzip and how to do things. i have not even included ajax or jquery here. – divakar Oct 03 '14 at 10:01

1 Answers1

3

Your question explicitly asked "How to Gzip a json file and read it from server?", not "what is gzip and how to do things"

The link actually have an answer marked

Browsers automatically add the accept-encoding header as appropriate, including on XHR requests. You don't need to do that at the DOM/JS level.

If you need detailed step by step:

  • Choose a mature web server (IIS, apache)
  • Create a directory
  • Put your json into a file with .json file extension
  • Make sure the MIME type is set, if you are using IIS check it out here

Gzip/deflate is done by the web server & almost all browsers. You do not have to do anything.

If you are generating dynamic json content as opposed to the above steps (static), just make sure your application is sending the mime type properly and let the browser do it.

Lee Gary
  • 2,357
  • 2
  • 22
  • 38
  • I need detailed step only. Thanks and i have a doubt? the browser will automatically decompress the file received from server? – divakar Oct 03 '14 at 10:10
  • Yes, if you have doubt, try using fiddler to see what exactly is being sent over the wire – Lee Gary Oct 03 '14 at 10:12