Well.... The page downloads in linear (line by line) so it depends...
If you reference your JS via src="/path/to.file.js" ... and have many of these files then you will be stunted by the paralell download stopping. However.... If you do some smart js thinking (like i did!!!!!!!!) you can make thigs very fast indeed... Basically what i done was.. Created a file that minifies my js files on the fly and outputs one long minified whitespace stripped string back to the browser which includes all of the javascript needed to run on any page .. For example if page 1 needs prototype and scripty and effects.js i would load all three, but if page 2 only needed prototype then i would only load that (hence concating them and minifying on the fly)... This speeded up page loading from around 6 seconds (with nearly 1.5 meg of javascript/images/css) to about 2.8 seconds - then it went on further using apache's deflate (which i had to remove due to a bug for now))... As i stated earlier what works for one may not work for others - i came up with my way because i wanted to be able to read and edit my javascript without having to re-minify every time i changed something... - also please note for debugging applications it is a nightmare because you have one long line of JS and firebug reports incorrect line numbers !!!! - but you can get the rough area of what's causing the error and open the original javascript file to fix... I am more than happy to let people have my source code and the concept should they want it. I was going to package it all up and put it on googlecode but i havn't got round to it yet Alex Mcauley http://www.thevacancymarket.com ----- Original Message ----- From: "Marko" <[email protected]> To: <[email protected]> Sent: Wednesday, September 16, 2009 1:51 PM Subject: [Proto-Scripty] Re: YSlow's rule "JavaScript at the bottom" w/Prototype > > Hi all, > > Here is description from YSlow: > /JavaScript scripts block parallel downloads; that is, when a script is > downloading, the browser will not start any other downloads. To help the > page load faster, move scripts to the bottom of the page if they are > deferrable. > > /Isn't that the point why to put it on the bottom. > > - Marko > > david wrote: >> Hi Javier, >> >> Alex answer is good, an I will follow his way. >> But it depend on a few things: >> - internet / intranet: meaning if response time to load JS files could >> be long, you should have as your collegue says an amount of time where >> your application, is not running, but all HTML will be load. A kind of >> "break time". >> - The amount of code executed, if it's very important, you'll still >> have that "break time" >> >> This break time could be disgracefull. but we are talking generally >> about hundreds of millisecondes. >> This is very short time for humans, but of course it make a big >> difference on charts. :)) >> I personnally put it on top, my users are not terminator ! >> >> -- >> david >> >> On 16 sep, 12:11, "Alex McAuley" <[email protected]> >> wrote: >> >>> Personaly form my experience putting JS at the top or bottom shaves only >>> a >>> second or so on page rendering/loading.... >>> >>> If you application relies heavily on javascript for its enhanced >>> functionality and needs the observers in place to function then i would >>> put >>> it at the top. >>> >>> for example.... >>> >>> Load the javascript in the head as normal, then add the event observer >>> for >>> dom/window load/ready to set the observers up... >>> >>> Yahoo's idea is only one out of many ways of doing things and what may >>> work >>> for them with their infrastructure and frameworks may not work or >>> benefit >>> everyone. >>> >>> Alex Mcauleyhttp://www.thevacancymarket.com >>> >>> ----- Original Message ----- >>> From: "skaiuoquer" <[email protected]> >>> To: "Prototype & script.aculo.us" >>> <[email protected]> >>> Sent: Tuesday, September 15, 2009 10:42 PM >>> Subject: [Proto-Scripty] YSlow's rule "JavaScript at the bottom" >>> w/Prototype >>> >>> >>>> Guys, I wonder if you can help me with this; >>>> >>>> I just had a twenty minute-long discussion with a senior co-worker on >>>> the YSlow rule "put JavaScript at the bottom"--for more information on >>>> it, please check out [ >>>> http://developer.yahoo.com/performance/rules.html#js_bottom >>>> ]. >>>> >>>> Now, I want to adhere to this rule as well as eliminate "onevent" >>>> attributes on HTML tags on a given product. >>>> >>>> My colleague thinks this is going to result in "bugs" when perplexed >>>> users are confronted with a "fully" rendered page and thus attempt to >>>> click on links that have no JS behaviour added yet--since I want all >>>> of the behaviour to be added using the 'observe' method. >>>> >>>> Is this so? Can you guys please shed some light on this subject on an >>>> application basing its JS on Prototype? >>>> >>>> Thanks in advance and warm regards, >>>> >>>> - Javier >>>> >> > >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
