Monthly Archives: October 2008

Google Maps Operation aborted on IE

If you are getting an annoying message like this

“Internet Explorer cannot open the Internet site”
“Operation aborted”

When trying to see a web page that contains a google map.
And right after the message pop ups Internet Explorer shows an empty page here are some tips to help you fixing this issue

First thing you’ll have to do. Is to move all the code used to generate the map to a function and call it once the page is loaded

  1.  
  2. function loadMap() {
  3.         // JS code to create your map
  4. }
  5. window.onload=function() {
  6.         loadMap();
  7. }
  8.  

If you are using prototype you can use

  1.  
  2. document.observe("dom:loaded", loadMap );
  3.  
  4. OR
  5.  
  6. Event.observe(window, ‘load’, loadMap, false);
  7.  

Or you can add an onload attribute to your body tag

  1.  
  2. <body onload="loadMap()">
  3.  

If you are using polylines you should add vml namespace to your header and should look like this

  1.  
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  5. <style type="text/css">
  6. v\:* {
  7. behavior:url(#default#VML);
  8. }
  9. </style>
  10.  

Loading the javascript needed to generate the map as an external file , and adding defer attribute so internet explorer will wait until it loads the page before executing the Javascript. It has the same effect than moving your JS code to the bottom of the page.

  1.  
  2. <script src="maps.js" type="text/javascript"  defer="defer"></script>
  3.  

It can be also a problem with a base tag messing wiht IE more info on
http://www.shauninman.com/archive/2007/04/13/operation_aborted