[ka-Map-users] gzip-ing .js
Brent Pedersen
bpederse at gmail.com
Mon Mar 6 10:57:27 EST 2006
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);
}
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20060306/d95a4038/attachment.html
More information about the ka-Map-users
mailing list