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

Complete Uninstall to Work in J4??
We have recently updated a site from Joomlav3 to v4 (4.4.2). Now when we go to m...
3 Replies
Posted on Tuesday, 30 April 2024
  • New
  • verschiedene URL's für Kursübersicht einer Kategor
    Hallo, ich habe eine Frage in Bezug auf SEO: ein externer Spezialist macht die...
    1 Replies
    Posted on Monday, 29 April 2024
  • New
  • Google no index für bestimmte Seiten/Details
    Hallo ich habe eine kleine Frage: wo kann ich einstellen, dass Google die Seite...
    1 Replies
    Posted on Wednesday, 24 April 2024
  • New
  • Changes to Submission Form?
    Are you able to make changes to the Hotspot submission form? There are several f...
    0 Replies
    Posted on Friday, 26 April 2024
  • New
  • Question regarding custom fields
    How do I access custom fields after I have created them?...
    0 Replies
    Posted on Wednesday, 24 April 2024
  • New
    • #custom fields