Dynamic Image Maps Crash Internet Explorer IE6 & IE7
We have been working on a couple of projects that use dynamic image maps. We had an issue that crashed IE6 and IE7 when a certain combination of links were clicked on. The scenario is that a user is presented with a map of Australia and clicks a state. We take that click, and return a map and imagemap of the state they clicked on. Then you click a region and keep drilling until there are no more maps.
The map of Australia, with each state mapped has 7 areas. The 7th area, in order, is Tasmania. Clicking on Tasmania uses ajax to put a map of Tasmania on the screen, and map Tasmania into 5 different areas.
When you click on the 7th area of the Australian map, Tasmania, IE gives focus to that area (area #7). Ajax correctly resets the image to the Tasmania map, rewrites the new 5 areas for Tasmania, then crashes. The problem is that IE was focussed on area 7 when you click on the map, but the new area map only has 5 areas, so IE freaks out and crashes.
There are several suggested solutions to this, most involve rewriting the code to use a new image map each time. The solution that seems to work easier for us was to change IE’s focus before we start doing the funky ajax stuff – change the focus to the first form field before doing anything else and it now seems to work. Note: If you are looking for solutions to this problem sometime in the future, make sure to be clear – the problem is the number of areas in your image map, NOT the number of co-ordinates in your map. Roughly half the people I found talking about it didn’t seem to get this and headed off in the wrong direction.