29

Things I am aware of:

  1. Screen flicker if scripts alter styles / content (not an issue for me as I currently load scripts at the end of the page and so have workarounds already)

  2. Inability to detect script load failure (not too concerned about this either as everything I develop is required to work with or without javascript. Might affect my workarounds for item 1 but happy with this risk)

It looks to be a very good option to me but I am hoping for some references (feel free to say only positive things!) before I invest time in incorporating it into my next project.

Currently we develop mid-to-large sized sites with, generally, a moderate amount of Javascript (although this is growing rapidly). We also use the jQuery library for the bulk of our Javascript.

Anyone have any experience? Good or bad! :)

P.S. for those interested this is head.js

Yi Jiang
  • 49,435
  • 16
  • 136
  • 136
Stuart Burrows
  • 10,824
  • 2
  • 34
  • 33
  • Until I figure out a better way to load stuff before the DOM finishes rendering, I'm hiding content initially and then calling `show()` in `head.ready()`. This way, there's still a flickr, but there's only one flash and the content isn't half-rendered for a split-second. – a paid nerd Mar 02 '11 at 21:35

5 Answers5

16

Nope. As long as you put any code that is dependent on the loading files inside head.ready {} then you will not face any problems with your code.

Phil Sturgeon
  • 30,637
  • 12
  • 78
  • 117
9

Here is my conclusion for head.js, I have done some benchmarks myself:

http://blog.feronovak.com/2011/03/headjs-script-is-it-really-necessary.html

It is subjective opinion and benchmarks are not by any means scientific.

feronovak
  • 2,687
  • 6
  • 35
  • 54
4

I was/am interested and thinking of maybe also using head.js BUT i found something not so nice: In the url that you gave me there are three tab buttons:

SCRIPT          SCRIPT SRC     head.js 
SRC in head     on bottom      on head 

Shift+Ctr+Refresh gives very little differences for me (+/-10ms between the three @ 120mbit line, firefox 3.6.13)

When I use Ctr+R refresh, the results on the head.js are consistently 100ms slower than the other two versions without head.js... So, its NOT always faster.

Sam
  • 15,254
  • 25
  • 90
  • 145
  • for me headjs is consistantly around 120ms but the rest are between 300-1k ms. – Raynos Jan 31 '11 at 01:05
  • @Raynos, did you use Ctr+R , Ctr+F5 or Ctr+Shift+R? – Sam Jan 31 '11 at 01:08
  • all of them. of course ctrl+shift+r/f5 was slower on normal but doesnt make a difference on headjs. – Raynos Jan 31 '11 at 01:09
  • Interesting! In your case head.js _DOES_ make things worhtwhile... perhaps its my browser thats not behaving as it should. Naughty Foxy! – Sam Jan 31 '11 at 01:10
1

There would be no problem on using jquery or javascript library heavily. Try to main each library as unique.

I am using prototype, scriptaculous, jquery and many more jquery additional plugins. I faced an error while loading entire scripts. Then i found out its due to $ sign which is an important parameter of jquery and prototype.

i had used

    $.noConflict();
jQuery(document).ready(function($){
//jquery codes here
})

So keep your script library unique

Mohan Ram
  • 8,345
  • 25
  • 81
  • 130
  • Thanks for your answer - this is good advice but I'm not certain it is entirely what I'm asking. I'm looking for any issues specific to head.js rather than using multiple libraries in general :) – Stuart Burrows Dec 21 '10 at 12:13
  • I just shared my problem i faced. to save u in your project. – Mohan Ram Dec 21 '10 at 12:15
0

head.js() gave a problem to my pages. None of my asp:button OnClick events were working. But if I include the scripts in the traditional way (<script type="text/javascript src="") then the events worked perfectly. I tried EnableClientScript = "false" and also CausesValidation="false". But nothing worked. Finally just scrapped the head.js idea since it did not make a lot of difference to my page load time, anyway.

A_AR
  • 508
  • 2
  • 6
  • 20