I have a JSON file on GitHub pages, it's about 2 MB uncompressed. I access that file via jQuery's $.get()
method. I'd like to gzip the file, which shrinks it to about 500 KB, but when I put the gzipped file on GitHub pages, $.get()
doesn't work with an error: Uncaught SyntaxError: Unexpected token
I think the problem is that GitHub pages doesn't set the Content-Encoding: gzip
header on the JSON file, and the GET request thinks it's dealing with a plain JSON file. Is there any way to either:
Content-Encoding: gzip
header to a .json
file, ORGithub pages is already gziping html, css, js, json,... It's useless to try to do better by gziping json yourself.
A 1.3M json is sent as 357KB one by github pages. See here and click on "load json" link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With