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=""></script>

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

<script src=""></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.


  1. Posted November 28, 2006 at 6:23 am | Permalink

    That’s very cool.

  2. Posted December 1, 2006 at 12:43 am | Permalink

    Hi Alex! Will Dojo Storage still work if pulled through cross-domain Dojo? Haven’t been able to test it yet.

  3. Posted December 4, 2006 at 7:23 am | Permalink

    Useful, indeed. This came up during the @media panel discussion, where the whole idea of edge caching was talked about; dojo, as ever, ahead of the game. :)

  4. Posted January 4, 2007 at 2:58 pm | Permalink

    An issue has been found with this approach of using cross-domain builds. See this bug for more info and a way to use the cross-domain build for 0.4.1:

3 Trackbacks

  1. By » Dojo 0.4.1 on December 6, 2006 at 3:52 am

    […] Taking the new Dojo 0.4.1 release for a Sunday drive is now easier than ever with the ability to include Dojo in your site using the Cross Domain Script loader. All you need is the xd url ( and some instructions. […]

  2. […] While trying out Dojo using the new easy include method, I found a weird JavaScript bug in IE6: […]

  3. By » Dojo 0.4.2 and beyond on February 15, 2007 at 4:44 pm

    […] While 0.4.2 doesn’t include new features, the build system has changed significantly thanks to the hard work of James Burke from AOL. It now supports cross-domain builds even better and a new sub-domain,, has been setup to support a brand-new web-based build tool. The 0.4.2rc1 build page is up and it includes details on how to use the simple x-domain inclusion script that we’re maintaining for all new releases. Significant work has gone into 0.4.2 to ensure that x-domain builds work correctly and the new web-based build tool will let you easily generate a new dojo.js file to optimize your deployments without ever needing to download the “source” of Dojo or learn how to use Ant. Needless to say, we’re tremendously excited about this. […]