I have a JSON file on GitHub pages, it is about 2 MB uncompressed. I access this file using the jQuery method $.get(). I would like a gzip file that compresses it to about 500 KB, but when I put the gzip file on GitHub pages, it $.get()does not work with an error:Uncaught SyntaxError: Unexpected token
I think the problem is that the GitHub pages do not set the header Content-Encoding: gzipin the JSON file, and the GET request considers that it is dealing with a simple JSON file. Is there any way:
- Configure GitHub pages to add a header
Content-Encoding: gzipto a file .json, OR - Configure the AJAX request so that it knows that it is dealing with a JSON file with gzipped, although the server did not tell it that the content is encrypted.
source
share