Infrequently Noted

Alex Russell on browsers, standards, and the process of progress.

Including Dojo, The Really Easy Way

AOL has been generously hosting builds of the toolkit in their CDN for some time, but using these builds has always seemed scary. Configuring local and remote copies of the same thing hardly seems like fun. Also, lots of people ask us for a way to "just include one file to get Dojo". It's an obvious thing to do, and it turns out the cross-domain infrastructure that AOL donated is the perfect solution to both problems!

In response to Amit Green's excellent suggestion, I've constructed a couple of very small "wrapper" files that will let you include the "Ajax" build of Dojo from various versions through the cross-domain loader. Including the latest stable Dojo couldn't be simpler:

<script src="http://download.dojotoolkit.org/dojo_0.3.1.js"></script>

It's also trivial to test out the latest 0.4.1 Release Candidate:

<script src="http://download.dojotoolkit.org/dojo_0.4.1rc2.js"></script>

That's all there is to it!

From here on in, your pages can use the dojo.require() system to pull in anything that's part of the "stock" distribution, and by following James' detailed documentation and test page, you can also load your own custom packages while still loading the main system from a separate domain.