Google Maps and Internet Explorer 6
As I posted yesterday, we pushed out some big updates to the Birmingham Wifi List that IPSA and TechBirmingham cooperatively produce. Today, an IE issue came up that I had not experienced while testing. Shame on me for using a Mac, I guess.
The error reared its ugly head when you tried to view the detail page of any wifi location either by clicking on the link in the info bubble of the map or the name of the location in the list below the map. The error basically stated:
Internet Explorer cannot open the Internet site http://www.ipsaonline.org/wifi/detail.php?id=229
operaton aborted
I couldn’t figure out for the life of me why this was happening until I ran a few Google searches on the error message. At first I thought it might be related to some of the PHP I was using to plot the location on the map dynamically from the database, but the Google search returned a different reason.
It actually has something to do with the way the Google Maps API writes the map back into the page. The normal setup for implementing a Google Map on a webpage is to write out an empty <div> where the map is supposed to go, then insert a chunk of Javascript that retrieves the map, sets the center point, the zoom level, and, in my case, plots a marker. All of this code is executed AFTER the empty div, so the API is basically writing back to an HTML element that has already rendered. That may not be an accurate explanation, but it is close enough.
One solution was to just move all of the Javascript to the end of the HTML page, either putting it just before the </body> element, or between it and the </html> element, or outside both of them. Well, I tried all 3 and neither did the trick. What I finally ended up doing was making the javascript a function and calling it in the <body> element.
I wrapped this around the Javascript:
function loadMap() {
google javascript here
}
And I placed this in the <body> element:
onload=”loadMap();”
That did the trick.




