Dojo 1.1 and 1.3 on the same page

June 16th, 2009 by Brian | Filed under 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.

  1. <html>
  2. <head>
  3. <title>Dojo 1.1 and Dojo 1.3 together on the same page </title>
  4.  
  5. <!– Bring in Dojo 1.1.x –>
  6. <script type="text/javascript">
  7.   djConfig = {
  8.     parseOnLoad: true,
  9.     baseUrl: "dojo11/dojo/"
  10.   }
  11. </script>
  12. <script type="text/javascript" src="dojo11/dojo/dojo.js"></script>
  13.  
  14. <!–
  15. redefine djConfig (allowed in 1.1+)
  16. create namespaced dojo, dijit &amp; dojox
  17. –>
  18. <script type="text/javascript">
  19.   djConfig = {
  20.     isDebug: true,
  21.     baseRelativePath: "dojo13/dojo",
  22.     scopeMap: [
  23.       ["dojo", "dojo13"],
  24.       ["dijit", "dijit13"],
  25.       ["dojox", "dojox13"]
  26.    ]
  27. }
  28. </script>
  29. <script type="text/javascript" src="dojo13/dojo/dojo.js"></script>
  30.  
  31. <!– test it –>
  32. <script type="text/javascript">
  33.   dojo.addOnLoad(function(){
  34.     alert(dojo.version);
  35.   });
  36.   dojo13.addOnLoad(function(){
  37.     alert(dojo13.version);
  38.  });
  39. </script>
  40. </head>
  41.  
  42. <body>
  43. Dojo 1.1 and Dojo 1.3 together on the same page
  44. </body>
  45.  
  46. </html>

Tags:

Share Your Thoughts