IE Error with Google Maps API
June 18th, 2006 by John
I have been working on implementing Google Maps into one of the websites that I am currently working on, and it has been pretty awesome. That is until I decided to take a peak at it in Internet Explorer. IE politely popped up an error message stating “Internet Explorer cannot open the Internet site. Operation aborted.” and failed to load the page.
I was a bit surprised at this because I was using code directly from Google’s documentation, and I figured that they had already done tons of testing on it in all browsers, and especially IE. But nonetheless, I was stuck with a scary looking error message, and a failed page.
After a quick Google search though, I came across another blog post with a simple fix. Apparently the problem lies in the fact that I had embedded the javascript for the map directly into the body of the page, immediately following the div that held the map. I had never considered placing it elsewhere since Google didn’t give me any reason to believe it might be necessary.
So I quickly moved the javascript outside of the body tag (the bottom of the document), and all of a sudden IE was happy again.
This error seems really strange to me, and I can’t figure out what it is about this particular javascript code that IE doesn’t like to see in within the body tags. I especially don’t understand how Google could have missed this, and why it is not in their documentation for the Maps API.
The most annoying thing about this whole error though was the fact that IE didn’t give any hints as to what might have been wrong. If I hadn’t found a quick solution through Googling the error message, I probably never would have figured it out.
Anyway, everything seems to be working now with this little fix.