Daniel Morrison

IE7 and Google Maps

I had an issue with YardVote.com not showing my Google Map properly in IE7 (and probably IE6). The map would just be blank, and no errors were coming up.

The fix ended up being pretty simple though it took far to long to discover.

I was calling the map function using Prototype’s dom:loaded event. While this should work (prototype works around IE’s limitations), it wasn’t in IE. Not wanting to delay execution for good browsers, I ended up with this ugly code:

// Dunno why IE doesn’t like dom:loaded.
if (Prototype.Browser.IE) {
Event.observe(window, “load”, Map.show);
} else {
Event.observe(window, “dom:loaded”, Map.show);

Certainly not ideal, but not that it works I can go back to doing fun stuff. Stupid IE.