Another less programming intensive way might be to compress your scripts 
with gzip.  If you're using PHP it's extremely easy.  All you have to do 
is change the extension of your javascript file from "js" to "php."  
That will ensure that the file will be shunted through the PHP 
interpreter.  Then, at the top of the file add this:

    <? ob_start("ob_gzhandler");
    header("Content-type: text/javascript"); ?>

And to the bottom of the file, add:

    <? ob_end_flush(); ?>

That will buffer your output and then, when you flush it, send it 
through a gzip compression.  The prototype 1.5.1_rc2 goes from 90ish KB 
to 25KB for me when I do this.  I'm not familiar with techniques to make 
it work in non-PHP languages, but there's probably a way you can get it 
to work.  PHP requires the zlib extension be compiled or dynamically 
loaded for this to work.

 -- Dash --

Justin wrote:
> I have a major problem with load time of my sites index.php page.
> Because there's so much Ajax/JavaScript placed in the <head> tags the
> page takes about 10 seconds to load the JS and then a further 5/7
> seconds to load the content giving me a total load time of about 17.22
> seconds and 170kb.
>
> So the theory here is that I load all the JS into the cache first but
> I'm suffering with a long page load time which is killing me. It
> wouldn't be so bad if a user saw some action but right now they have
> to wait 10 seconds minimum before they evern begin to see the content
> load which is frustrating.
>
> Is there some way in which I can rather load a specific JS code on
> clicking a link that requires that JS code instead of pre-loading it
> in the <head> tag? I'm guessing it will have something to do with the
> onclick event but I really don't know and any help is really really
> appreciated.
>
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to