dojo icon

Dojo - Remote Script Problem

Posted in , Sun, 04 Jun 2006 04:11:00 GMT

Dojo Toolkit 0.3.0 seems to have a problem loading it's javascript libraries remotely, i.e. when the Dojo scripts are hosted on a server different than where the HTML is. For example, if the page includes The main Dojo file, dojo.js, runs fine when loaded remotely, however the following fatal errors occur when it attempts to load its external libraries:

FATAL: Could not load '';
   last tried '__package__.js'
FATAL: Could not load 'dojo.widget.ComboBox';
   last tried '__package__.js'

It was suggested this could be due to XSS protections. Scriptaculous' scriptaculous.js, however, has a way around this since it can be loaded remotely and access it's external files (builder.js, controls.js, etc.). Often it's nice to have static files hosted on a separate server. Is there a way to fix this issue for Dojo?

UPDATE 1: For now, I'm going to stick with and Scriptaculous autocomplete. A nice thing about this set up is I can load a remote dojo.js browserio build w/o issues since it doesn't need call any external libraries for just bind.

UPDATE 2: Alex Russell provided a uri for cross domain package loading. You can turn on cross domain support by using a custom build and setting the dojoLoader option to xdomain option:

ant -Dprofile=ajax -DdojoLoader=xdomain
  -Ddocless=true clean release intern-strings

If you don't want to build it yourself, James Burke has done it and made it available as dojo-0.3.1-ajax-xd.tar.gz. This page has some more info. - Remote Script Problem digg:Dojo - Remote Script Problem reddit:Dojo - Remote Script Problem spurl:Dojo - Remote Script Problem wists:Dojo - Remote Script Problem simpy:Dojo - Remote Script Problem newsvine:Dojo - Remote Script Problem blinklist:Dojo - Remote Script Problem furl:Dojo - Remote Script Problem fark:Dojo - Remote Script Problem blogmarks:Dojo - Remote Script Problem Y!:Dojo - Remote Script Problem smarking:Dojo - Remote Script Problem magnolia:Dojo - Remote Script Problem segnalo:Dojo - Remote Script Problem



  1. alex said 1 day later:

    this isn’t a Dojo problem, it’s the intrinsic cross-domain security model of browsers. We have, however, implemented what we call the “cross-domain package loader”. There’s a wiki page that describes it and how to use it here:

    This is something that’s totally new and no other toolkit supports anything like it (mostly because most toolkits haven’t evolved package systems either).

    So long story short: you’re working against the grain of the browser, but Dojo still has your back, if you’re willing to put in a little bit of effort (a custom build).


  2. John Wang said 1 day later:

    Thanks for the link. I’ll check it out soon. It’s nice to know even with its more complex architecture, it can still support things like cross-domain library loading.

    Regarding the custom build, my understanding is that Java and Ant are required. I don’t have this environment so I’ll have to schedule some time. Custom Dojo builds seem to come up a lot and I’ve been thinking that Dojo would get many more users if either of the following were available:

    1. lighter-weight build system that doesn’t require Java / Ant
    2. a website that builds a custom dojo.js based on options selected via a form

    Have there been any thoughts in these directions?

  3. DojoNumberNine said about 1 month later:

    on the website side of things, dojo is very much a work in progress (though a sturdy one at that) and is in need of people to implement the features you have suggested. a website-based selection feature would be awesome, and you could get google adwords clicks to boot if you set it up.. (-;

  4. Faisal khan said 4 months later:

    i m great full to you, problem solved by var djConfig = { baseScriptUri:’/javascripts/dojo/’ }; putting this


(leave url/email »)

   Comment Markup Help Preview comment