[TYPO3-dev] prototype and compressed
Steffen Kamper
steffen at sk-typo3.de
Thu Mar 13 20:15:39 CET 2008
"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