You can look at LABjs , which is the script loader.
Old and busted:
<script src="framework.js"></script> <script src="plugin.framework.js"></script> <script src="myplugin.framework.js"></script> <script src="init.js"></script>
New hotness:
<script> $LAB .script("framework.js").wait() .script("plugin.framework.js") .script("myplugin.framework.js").wait() .script("init.js").wait(); </script>
Update : If you want to download jQuery, you can do something similar from this blog post .
<script type="text/javascript" src="LAB.js"> if (typeof window.jQuery === "undefined") { $LAB.script("/local/jquery-1.4.min.js"); }
Mark coleman
source share