php - GZip Compression For JQuery Without Server Access
all. I am required to build a website with each page under 130kb. I know that JQuery 1.4.4 is ~28kb when it's g-zipped, but it's 77kb minified, which is just too much for this particular assignment. I have already built the entire site using JQuery in one implementation or another on each page, so scrapping it would mean days of wasted time.
With that in mind,
2) From the phpinfo file, I know that ZLIB compression is enabled, but "zlib.output_compression" is not.
3) I realize this can be done using .htaccess. However, I'd like to do it any other way, if possible, since I don't want the school thinking I'm trying to modify their server configuration.
4) Will XHR's setrequestheader method work here, or is that only good for asynchronous files?
I know this is short notice and all, but my Final presentation is tomorrow, and I'll lose a ton of points if my site is over the size limit. Any help would be much appreciated!
You have two options
Use jquery hosted somewhere else that supports gzip. The file is here that you need to include http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js This gives you a lot more advantages such as parallel downloading of files and quicker page load times.
Other options is to use PHP code to zip the jquery js and return it. Here is an example http://www.lateralcode.com/gzip-files-with-htaccess-and-php/
Use http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js, which is GZIPed.