Handling dependencies for asynchronously loaded JavaScript

6 views
Skip to first unread message

Joachim De Lombaert

unread,
Nov 19, 2008, 8:11:57 PM11/19/08
to cs193...@googlegroups.com
Hey all,

In case you're interested, I wrote a wrapper function for loading
scripts after the page onload event and then running code that depends
on them (i.e. Google Analytics). You don't have to modify the
external scripts at all with my method, and it's really easy to use.
Here's what it looks like:

postLoadJS("http://www.example.com/js/external.js", function() {
// code to run on load
});

Take a look:
http://pcheese.net/writings/postonloadjs.html

Please let me know if you find bugs!
--
Joachim De Lombaert

Reply all
Reply to author
Forward
0 new messages