0

I need to prioritize scripts so jQuery, Cufon, and my .js files come before Twitter does. I've tried defer="defer" as well as placing scripts in the bottom in the order I want them to execute but all these methods aren't working.

I don't want to modify Twitter's files either. Anything I can do?

tshepang
  • 10,772
  • 21
  • 84
  • 127
Brandon Wang
  • 2,771
  • 5
  • 26
  • 34

2 Answers2

1

Have your script create the html to have the Twitter script downloaded. That way it will be loaded and executed after your script, which comes after jQuery and Cufon.

James Black
  • 40,548
  • 9
  • 79
  • 153
0

Remember that defer is not standard and only supported by IE. Also, give more information. "aren't working" isn't a lot to go by. The order of compiling and executing Javascript is well define, so if you're doing things right they should execute in the right order. However, remember that a syntax error in any block will forbid the entire block from executing, so make sure something you think is running earlier is actually running at all.

ironfroggy
  • 7,415
  • 6
  • 30
  • 41
  • IIRC, FF3.5 supports defer as well. It's also being codified in HTML5, so expect more support across browsers (webkit, for example, is already working on it — https://bugs.webkit.org/show_bug.cgi?id=20710) – kangax Oct 18 '09 at 22:37
  • I'm fairly sure my code is correct: it all runs, but Twitter holds Cufon, jQuery, etc. from running and the website looks ridiculous. Also, the jump is unacceptable. In the end I just used append() to add the Twitter code. It was my understanding that this wouldn't work so I was very surprised when it worked. – Brandon Wang Oct 20 '09 at 02:26