2

I declare object in some.js what is loaded by head.js, and in head.ready(function(){}) I need to add something to object. But in Explorer 10 (sometimes in other broswers) console say object is undefined.

I think that head.ready(function(){}) sometimes is called before js files loaded.

Do somebody have same behavior?

Thanks

tom52
  • 305
  • 2
  • 8

1 Answers1

0

I have the exact same behavior. I'm running IE9 and version 0.99 of headjs. Scripts loaded by head.js are loaded twice, and the head.ready function is indeed called prior to any other script having been loaded. This seems to be related to internet explorer (version 9?). In Chrome and Firefox it works as expected.

peter
  • 1
  • 2
    Found someone else's tip here which was useful (http://stackoverflow.com/questions/13413749/is-it-possible-to-make-head-jss-ready-function-wait-for-two-scripts). Regarding IE9 as described, I could simply give the last loaded script in head.js() a label name which was used as the trigger for waiting for the last script to be loaded by head. So, the ready function became head.ready("last_script", function() {} ); – peter Feb 15 '13 at 14:47