Select to view content in your preferred language

dojo is undefined

4999
8
09-22-2010 09:23 AM
MichaelRose
Occasional Contributor
I have developed a fairly simple Javascript based website that shows fine on my development box.  However, if the same site is accessed from another machine, the map disappears and I get the 'dojo is undefined error'.

I moved the code to our server and I am getting similar results.  I can see the page if I am logged on the server, but if I try and access from another machine, same error as above.

Is there a configuration file that I am missing here?

I really appreciate the help!
0 Kudos
8 Replies
by Anonymous User
Not applicable
A couple of items you will want to check.

1) Are you hosting the JavaScript API locally or using the library hosted on ESRI's website?  I recommend using ESRI's library while you work through this problem.

(example - this using ESRI's library)
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1"></script>

(example - this not using ESRI's library)
<script type="text/javascript" src="http://<myserver>/arcgis_js_api/library/2.0/arcgis/"></script>


2) Make sure all your JavaScript files live on the web server?

3) It may be helpful to update this forum including the URL you're using to access the page and also the JavaScript code found in your header. 


Doug Carroll, ESRI Support Services SDK Team
http://support.esri.com/
0 Kudos
GeoffreyMahase
Emerging Contributor
I'm having a similar issue.  Some machines will receive this error intermittently in IE6, and the 1st time they log onto the page in IE8.  It seems to be fine in Chrome and FF though.

Looking on the web, there seems to be a history of this in dojo.
Old bug report which was resolved: http://bugs.dojotoolkit.org/ticket/2280

Slow connections?
http://forums.novell.com/novell-product-support-forums/identity-manager/im-userapp-workflow/389077-e...

Not exactly sure what it is, but I'd like to get rid of it.  Does anyone have a workaround?

Also is v2.1 the new version? is it safe to use with 9.3.1?  The documentation for 9.3.1 doesn't make a reference to that one. (http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm#jshelp/...)
0 Kudos
HeribertoMantilla_Santamaría
Deactivated User
Hi Michael, try use the Firebug in FF and view what's the problem exactly.

Review any extra comma in the js file.

I'm having a similar issue.  Some machines will receive this error intermittently in IE6, and the 1st time they log onto the page in IE8.  It seems to be fine in Chrome and FF though.


In IE the most common answer for this behavior is a extra comma in client/application.js file
0 Kudos
timgogl
Deactivated User
probably wont be able to find the errors in firefox with firebug since you're not getting errors in that browser.

however, you can get and use firebug lite in IE, and it may be robust enough to get you an answer in IE.
0 Kudos
HeribertoMantilla_Santamaría
Deactivated User
But Michael doesn't specify that bug only happens in IE.
0 Kudos
timgogl
Deactivated User
I'm having a similar issue. Some machines will receive this error intermittently in IE6, and the 1st time they log onto the page in IE8. It seems to be fine in Chrome and FF though.


yeah he did 🙂 although i didn't notice that IE 6 was only intermittently. anyway... good luck with finding a solution.
0 Kudos
AxelSchaefer
Emerging Contributor
My 2 cent for dojo not defined:

Application works on development-machine #1 and not on production-machine #2 with the same browser: Often an issue of different domains. The JS-API has to be configured with FQDN, the application also. Test it with a simple client to get to know if it's an application issue or a system-environment issue.

Application works on browser #1 but not on IE: Often a problem of the application code. Missing commas, semicolons, forgotten var declarations. Firefox walks over this issues, IE doesn't. Strip down the application, comment functionality to get to know where and when the error occurs.

HTH.
0 Kudos
GeoffreyMahase
Emerging Contributor
I think I resolved my issue.  I was mistaken about it being the dojo is undefined error, I was conflating it with the dojo.body() is null or undefined.

Basically what I was doing was that I was working with templated widgets and initializing the member variables to esri items.

eg:
dojo.provide("blah.BlahBlah");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.declare("blah.BlahBlah", [dijit._Widget, dijit._Templated],
  templateString: "<div style='display: none;'></div>",
  hover: new esri.layers.GraphicsLayer({id:"hover"}),
  ...
}


This seemed to cause a race condition in IE.  Moving that initialization to startup seemed to resolve the issue.  I'm still testing this, but it seems to have fixed it for me.
0 Kudos