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?

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

2 Comments

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 — bugs.webkit.org/show_bug.cgi?id=20710)
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.