Archive for June, 2009

Dojo 1.1 and 1.3 on the same page

June 16th, 2009 by Brian | 3 Comments | Filed in work

Today I dug into the deep dark world of running multiple versions of Dojo on the same page. Turns out, it’s not all that dark! Working with some pages as my guide I was able to get 1.1 & 1.3 working in the same page.

This is a step towards running multiple versions withing WebSphere Portal, which I’ll likely be dealing with in the near future.

<html>
<head>
<title>Dojo 1.1 and Dojo 1.3 together on the same page </title>

<!– Bring in Dojo 1.1.x –>
<script type="text/javascript">
  djConfig = {
    parseOnLoad: true,
    baseUrl: "dojo11/dojo/"
  }
</script>
<script type="text/javascript" src="dojo11/dojo/dojo.js"></script>

<!–
redefine djConfig (allowed in 1.1+)
create namespaced dojo, dijit &amp; dojox
–>
<script type="text/javascript">
  djConfig = {
    isDebug: true,
    baseRelativePath: "dojo13/dojo",
    scopeMap: [
      ["dojo", "dojo13"],
      ["dijit", "dijit13"],
      ["dojox", "dojox13"]
   ]
}
</script>
<script type="text/javascript" src="dojo13/dojo/dojo.js"></script>

<!– test it –>
<script type="text/javascript">
  dojo.addOnLoad(function(){
    alert(dojo.version);
  });
  dojo13.addOnLoad(function(){
    alert(dojo13.version);
 });
</script>
</head>

<body>
Dojo 1.1 and Dojo 1.3 together on the same page
</body>

</html>

Tags: