[TYPO3-dev] prototype and compressed
Jerome Schneider
typo3dev at ameos.com
Fri Mar 14 14:12:54 CET 2008
Hu Steffen,
I think that checking in $GLOBALS["_SERVER"] for something like
"Accept-Encoding: gzip,deflate" would do it
It's an HTTP header sent by the client to the server.
More infos here
http://www.expertsrt.com/tutorials/Matt/HTTP_headers.html#requestheaders
Best regards,
Jerome
Steffen Kamper a écrit :
> "Jerome Schneider" <typo3dev at ameos.com> schrieb im Newsbeitrag
> news:mailman.1.1205403594.20238.typo3-dev at lists.netfielders.de...
>> Hi,
>>
>> I'm using pre-processed minified and gzipped javascript to serve prototype
>> and other js libraries, and it works just great with real size deflation.
>>
>> regular prototype + my other js files => 166KB
>> same, minified => 120KB
>> same, minified+gzip'd => 31KB !!
>>
>> To serve gzipd js, you'll need this HTTP header:
>>
>> Content-encoding: gzip
>>
>> I use this piece of code to add this header this without any need of
>> apache's mod-deflate:
>>
>> <?php
>> header("Content-Type: text/javascript");
>> header("Content-Encoding: gzip");
>> header("Cache-Control: max-age=86400, public");
>> fpassthru(fopen(realpath("./formidable.minified.js.gz"), "rb"));
>> exit;
>> ?>
>>
>> And then tell the browser that javascript is hosted at the address of this
>> php-script.
>>
>>
>> I tested this on Firefox windows, Safari windows/osx, IE6/7 and Opera
>> windows, and it worked just fine.
>>
>> Improvement would be to check if client accepts content-encoding gzip.
>>
>> Bye,
>> Jerome Schneider
>>
>
> Hi Jerome,
>
> this looks good!
> Do you have an idea how to check if gzip is supported?
>
> vg Steffen
>
>
More information about the TYPO3-dev
mailing list