[ka-Map-users] gzip-ing .js

David Bitner osgis.lists at gmail.com
Mon Mar 6 11:48:49 EST 2006


I've used this PHP method succesfully with other js for quite a while.
 Another option in Apache is to use mod_gzip or mod_deflate to
compress all html,js, and css that goes through the webserver.

On 3/6/06, Brent Pedersen <bpederse at gmail.com> wrote:
> hi, just saw this use of php that seems especially applicable to ka-map
> javascript.
> you can get php to gzip .js (or .css) files for you. this seems to be
> working pretty well. (see code below.) it gets it down to a single request
> of 27K instead of 8 requests totalling > 130K.
>
> -brent
>
>
> <?php
> ob_start ("ob_gzhandler");
> header("Content-type: text/javascript; charset: UTF-8");
> header("Cache-Control: must-revalidate");
> $days = 30;
> $offset = 60 * 60 * 24 * $days;
> $ExpStr = "Expires: " .
> gmdate("D, d M Y H:i:s",
> time() + $offset) . " GMT";
> header($ExpStr);
>
> $files = array("DHTMLapi.js", "xhr.js", "jsExpander.js ", "kaMap.js",
> "kaTool.js", "startUp.js", "extra.js","testExtents.js");
>
> foreach ($files as $fi){
>   print file_get_contents($fi);
> }
>
> ?>
>
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>
>
>



More information about the ka-Map-users mailing list