[ka-Map-users] gzip-ing .js
Paul Ramsey
pramsey at refractions.net
Mon Mar 6 17:13:46 EST 2006
Make sure you test this well across multiple platforms before you
implement. Some browsers are happy to accept gzip encoded HTML, but
croak when handed .js or .css gzipped.
P
On Mar 6, 2006, at 8:48 AM, David Bitner wrote:
> 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
>>
>>
>>
>
> _______________________________________________
> 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