ArcGIS API for JavaScript – Error in Dojo parser.parse()

arcgis-javascript-api

I started creating a Dijit based on a template HTML file. I started by referencing Dojo CSS and JS directly, and all was fine.

Later when I wanted to add a map into my dijit, first – changing nothing else – I switched my Dojo CSS links from googleapis.com to js.arcgis.com – and all was still fine.

But then I changed the Dojo JS script reference from googleapis.com to the ArcGIS API for Javascript. Doing this causes an error.

All else staying the same, this worked fine:

    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js"></script>

    <script>
        require([
            "dojo/parser",
            "dijit/layout/BorderContainer",
            "dijit/layout/TabContainer",
            "dijit/layout/ContentPane",
            "dojox/layout/ExpandoPane",
            "dojo/domReady!"],
            function (parser) {
                parser.parse();
            });
    </script>

But simply changing out that first script tag with:

    <script src="http://js.arcgis.com/3.8/"></script>

I get: dojo/parser::parse() error TypeError: Unable to get property 'toString' of undefined or null reference when I run the page.

I can provide more detail, but I don't want to put you to sleep. Thanks!

Update: upon further toying, I see this doesn't happen every time the app starts. It happens ~3 starts out of 10 on one of my dev workstations, but every start on my other one. The first is IE10 with fast internet, the second is IE11 with moderate, whatever that's worth.

Chrome gives a little more info:

enter image description here

Best Answer

Can't have lang="en" attribute on the opening HTML tag of the page. Found that gem way down a long ESRI forum post (reply #8) that I'd been too impatient to read before.

Related Question