Saturday, June 27, 2009

Wonder how ArcGIS Javascript API examples work so well in IE8

I decided to spend some time upgrading my ArcGIS Javascript API RESTful apps so that they would work well in IE 8 since so many of our users are making the upgrade. So using the latest version of ArcGIS Javascript API 1.4, I started to check my code against their examples, and if you've read my previous post, you would of seen that the I mentioned some of the issues that I was having with IE8.

Well after spending some time looking through the examples, it appeared that ESRI was able to make all the problems disappear in IE8 that I was having in my code. So, off to work I went trying to figure out what they did in for each of the dojo tools that failed to work for me. After very little time spent, I noticed that I was implementing most of the functions pretty much the same as they were, so I decided to start at the top of their code and go line for line. It didn't take long then. When I looked at the first example, when I reached line 5, i noticed the following line:

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

Well, for those of you who don't know, this forces IE8 to go into compatibility mode, and actually view the page as if it were IE7.

So that is how they did it. they didn't fix anything at all, and better yet, their examples truly do not work correct in IE8. I downloaded the test page, and commented that line out, and low and behold, their own map services don't load correctly using the latest version (1.4) of their API. If you care to see what their example looks like with line 5 commented visit http://paco.agcenter.lsu.edu/gis/hsrg/index2.htm.

So the moral of this blog is, if you want to upgrade to ArcGIS Javascript API 1.4 and have users visit your site using IE 8, you are going to have to force IE8 browsers into IE7 compatibility mode.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete