yeeen
yeeen

Reputation: 4945

How to include dojo correctly?

I would like to included dojo files download to my machine, how to do so? I kept getting "dojo is not defined" in the Error Console and the webpage does not show up the same as the original. What am I missing out?

The original ones had these:

<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
        djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
        dojo.require("dojox.layout.FloatingPane");
        dojo.require("dijit.form.Button");
</script>

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"
        />
<style type="text/css">
        @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/layout/resources/FloatingPane.css";
        @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/layout/resources/ResizeHandle.css";
 </style>

I didn't see any "dojo.xd.js" file in my downloaded dojo folder, so I changed them to these:

<script src="C:/Users/Yeeen/Desktop/WebpageTest/js/src/dojo/dojo.js.uncompressed.js"
        djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
        dojo.require("dojox.layout.FloatingPane");
        dojo.require("dijit.form.Button");
</script>

<link rel="stylesheet" type="text/css" href="C:/Users/Yeeen/Desktop/WebpageTest/js/src/dijit/themes/claro/claro.css"
        />
<style type="text/css">
        @import "C:/Users/Yeeen/Desktop/WebpageTest/js/src/dojox/layout/resources/FloatingPane.css";
        @import "C:/Users/Yeeen/Desktop/WebpageTest/js/src/dojox/layout/resources/ResizeHandle.css";
 </style>

Upvotes: 1

Views: 2794

Answers (1)

hugomg
hugomg

Reputation: 69934

I'm not sure this would directly fix your problem but you should try installing a webserver in your machine so that you can point to http://localhost/something instead of using a file:// address. Some browsers don't allow AJAX from a file:// origin and that can be annoying (and might mess up the module system)

As for the immediate problem, I am not sure browsers handle that C: in the address very well. Have you tried using relative filepaths instead?

Upvotes: 3

Related Questions