Amen
Amen

Reputation: 713

dojo toolkit question about loading the base dojo.js file

I am getting used to the dojo toolkit. So my question is does the following code mean to load the base dojo code?

var djConfig = {  
     baseScriptUri: "js/dojo/"  
 };

Would I use the following code if I am using a CDN?

var djConfig = {    
     baseScriptUri: "http://o.aolcdn.com/dojo/"    
 };

or would I write the code this way?

var djConfig = {    
     baseScriptUri: "http://o.aolcdn.com/dojo/1.3.2/dojo/"    
 };

I am looking at a lot of dojo toolkit examples from the following website and they all have this code:

http://www.java2s.com/Tutorial/JavaScript/0570_Dojo-toolkit/Catalog0570_Dojo-toolkit.htm

Upvotes: 0

Views: 1521

Answers (1)

Brian Clozel
Brian Clozel

Reputation: 59056

Loading Dojo

No. This code won't load any javascript file in your browser.

djConfig is the base configuration for the dojo framework (the way it loads resources, locales, parsing configuration...). Actually, the baseScriptUri key is not mandatory and tells dojo where to load additional resources (in case you changed the directory architecture).

So you still need that good old <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.2/dojo/dojo.js" djConfig="YOUR CONFIG HERE"></script>.

For further questions, what version are you using?

Mode info on XDomain loading

If you want to load a XDomain version of dojo, you have to configure djConfig accordingly with useXDomain = true.

And don't forget to sprinkle dojo.addOnLoad() here and there when you expect your code to load other parts of dojo (that's the downside of XDomain loading).

Example:

<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.2/dojo/dojo.xd.js" djConfig="useXDomain:true"></script>

Upvotes: 1

Related Questions