I did find a good article by Nicholas Zakas on this topic and its a cross-browser compatible way of doing it. http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/
I also found another article by him and he doesn't recommend using script loaders because of browser detection. http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/ My current project uses a few jQuery plugins on some of the pages, which is the main reason that I wanted to load these external JS files into the page if a plugin is being used, and obviously not load the plugin script if the plugin isn't being used on the page, since that would be unnecessary overhead. I think the first approach is suitable enough for my project since I don't plan on separating JS loading and execution. I'll probably just include the jQuery library and my application's JS file (which also contains the script loading function) into the page so I don't have to deal with maintaining script order execution. The project may be out of my hands so I don't want a solution that uses browser detection and have the application break on my client later down the road. On Aug 1, 4:10 am, Dmitry Pashkevich <[email protected]> wrote: > Or LABjs which has a smaller footprint.http://labjs.com/ -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
