1. emeyer
  2. Newbies area
  3. Friday, 10 April 2009
  4.  Subscribe via email
Wow, my prototype site really speeded up with 4.0! thank you!

I made a small modification to further improve speed: compressing the compnent's javascript file. For this, one can compress it in advance, but that requires custom mime types, and the propcessor load is so low, it's easier to do it on the fily. The server must have gzip compression available in the system (which can be picked up from Joomla global config, but Joomla only compresses html files).

Compression reduced the file from 32KB to 5KB. I tried packing it beforehand but it didn't make any diference, gzip is pretty fantastic these days. The code change is simple:

1: Add the following to the top of components/com_comment/joscomment/jscripts/client.js and save it as client.php in the same directory:

<?php
ob_start ("ob_gzhandler");
header("Content-type: text/javascript");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>


2. Find the reference to client.js in components/com_comment/joscomment/jscript.php and change it to client.php.

That's it. It threw an IE7 error in 3.26 for one of the http functions but worked fine in 4.0. I'm looking into doing the same for an external jquery library component and combining the pieces into one file.

The files are arriving with jquery in the head. I haven't looked at that yet, but already the size is 27KB less.
Responses (3)


There are %s replies to this question. If you want to see them you need a valid subscription.
If you have a valid subscription, please login now.
Visit store now

Last questions

Changes to the Submission form
Can you make changes to the Submission form? There are a few fields I'd like to ...
0 Replies
Posted on Thursday, 18 April 2024
  • New
  • Questions on new installation...
    Working on getting this set up... https://eastend2024.joepolecheck.com/rumma...
    2 Replies
    Posted on Wednesday, 17 April 2024
  • New
  • Error received? Class "XMLReader" not fo
    Just installed the Pro version of Hotspots, but am getting an error when I try t...
    1 Replies
    Posted on Wednesday, 17 April 2024
  • Resolved
  • New
  • Links aus Veranstaltungsübersicht funktionieren ni
    Nach der Migration von Joomla 3.10 auf Joomla 5.0.3 treten folgende Probleme auf...
    2 Replies
    Posted on Monday, 08 April 2024
    Custom Hotspot Marker fails to load
    I just updated from Joomla 3 to Joomla 4.3.4 and Hotspots 6.0.12. I decided to e...
    0 Replies
    Posted on Tuesday, 09 April 2024