Trouble with JS API v3.4 in IE8

763
6
06-28-2013 08:39 AM
BrianBeck
New Contributor III
I have a JS API v3.4 web application that works fine in Chrome, Firefox, and IE 10, but for some reason in IE 8 the page won't load.

When I look at the console in IE 8 all I get is:

'undefined' is null or not an object


This error says it occurs in the 3.4 API file at line 15, character 13,092, which doesn't help me at all in determining the cause of the problem because the API is minified.

Any idea what could be causing this issue in IE 8 only?  According to the JS API docs, it should be supported in IE 7-10.
0 Kudos
6 Replies
JonathanUihlein
Esri Regular Contributor
Can you post some code snippets?
Need more information to accurately assess the problem.

*edit

I took a minute to do a search and saw a lot of posts that suggest forcing IE8 into compatibility mode with the following line.

<meta http-equiv="X-UA-Compatible" content="IE=7" />

Apparently this fixes some long standing issues but I don't know if it helps you at all.
0 Kudos
BrianBeck
New Contributor III
Hi Jon,

Thanks for your reply.  I'm not sure which code snippets would be valuable considering the error occurs in the API itself and not in my code. 

Here are the scripts in the <head> section of my page:

<script>
            
            var dojoConfig = {
                parseOnLoad : true,
                packages : [{
                    name : "pgonline",
                    location : location.href.replace(/\/[^/]+(\.html.*)|\?.*/, "").replace(/\/[^/]+\/?$/,"") + "/PGOnline"
                }]
            };
        </script>

        <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script>

        <script type="text/javascript">
        
            require([
                "dijit/layout/BorderContainer",
                "dijit/layout/ContentPane"
            ]);
            
            var main;
            
            require(["pgonline/Main"], function(Main) {
                
                var settings = {
                    webmapID : "4b658923d0924336a08bfbbd4c72121f",
                    titleDiv : "title",
                    mapDiv : "map",
                    
                    menu : "menu",
                    overviewDiv : "overviewDiv",
                    geocoderDiv : "search",
                    mainWindow : "mainWindow",
                    tableParent : "centerPane",
                    headerDiv : "header",
                    
                    withBasemap : true,
                    withMeasure : true,
                    withDrawing : true,
                    withLegend : true,
                    withQuery : true,
                    withNavToolbar : true,
                    withPrinter : true,
                    withPlotter : true,
                    withFinder : false,
                    withEditor : false,
                    
                    withToggles : true,
                    withTable : true,
                    withSummary : true,
                    withPriorization : true,
                    withSymbology : true,
                    withExport : true,
                    
                    withPlannerToolbar : true
                };
                
                main = new Main(settings)
                
            });

        </script>


Through further investigation I did determine that the error occurs after the dojoConfig object has been created and the API has been loaded.  It appears to occur upon the call to
main = new Main(settings)
but the constructor of Main never gets called.

Main.js is the module I created to do all the main Javascript processing like loading the web map from AGOL, initializing all my custom widgets and Esri widgets, etc.
0 Kudos
BrianBeck
New Contributor III
Jon,

It turns out I've already got that meta tag in the html document, but still no luck.

Thanks for the help.
Brian
0 Kudos
KellyHutchins
Esri Frequent Contributor
IE can be picky about things that other browsers (Chrome, Firefox) are ok with like undeclared variables, trailing commas and missing semi-colons. Try running the code in your main javascript file through a problem detection tool like js hint and see if it returns any issues:

http://www.jshint.com/
0 Kudos
BrianBeck
New Contributor III
Well I tried JSHint and found a few issues.  They're all fixed now, but still having the same issues.  It looks like the issue occurs at
require(["pgonline/Main"]...


It doesn't even get to
var settings...


If I put a breakpoint in the constructor of Main, the breakpoint will not get hit.  A breakpoint isn't even hit if it is at
return declare("pgonline/Main"...

inside the Main module.

I have no clue what could be happening.

Thanks for all the help.
0 Kudos
KellyHutchins
Esri Frequent Contributor
If you can post all your code we can take a look.
0 Kudos