Bite my bytes

What I learn by day I blog at night - A blog from Microsoft Consultant working from Ljubljana, Slovenia

  Home :: Contact :: Syndication  
  999 Posts :: 7691 Comments :: 235 Trackbacks

Search

Most popular posts

Categories

My Projects

Archives

Stuff


Copyright © by David Vidmar
 
Contact me!
 
LinkedIn Profile
 
 
 

Google Maps API is a beast that's very easy to handle. I whipped si.blogs map together in no time, the majority of work went into collection the geocodes from sites. (not to brag, but the initial design of the site made it very simple to add this feature) The only real problem I encountered was Internet Explorer crashing badly with "Operation Aborted" error when displaying the map but everything worked smoothly in Firefox and Safari. Nasty bug with very little room for debugging.

After some Google Grouping it turned out that IE doesn't allow changing HTML tables via DOM until they are fully rendered. And since Google Maps code does just that the solution was to move the <script> to the end of the HTML while leaving the map <div> in the place where I wanted the map.

Posted on Monday, August 22, 2005 7:38 PM | Filed under: Developement |

Feedback

# re: Google maps crash IE 8/25/2005 8:48 PM Greg G.
Thanks! I was just trying to figure this one out!

# re: Google maps crash IE 8/25/2005 10:50 PM David
You're welcome!

# re: Google maps crash IE 9/9/2005 1:14 PM Marc
Great solution. Thanks!

# re: Google maps crash IE 9/11/2005 11:43 PM David
You are welcome! :)

# re: Google maps crash IE 10/18/2005 2:47 AM Blue
Didn't work for me. So do I just cut the whole

<script type="text/javascript">
//<![CDATA[
var mapMarker = new GMarker(new GPoint(<%=tempLocation.getMaplink()%>));
var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.centerAndZoom(new GPoint(<%=tempLocation.getMaplink()%>), 2);
map.addOverlay(mapMarker);
//]]>
</script>

thing and put it right before the </html> tag.

This is a jsp page by the way. Ignore the <&=tempLocation.getMaplink()%> thing its just a variable for the map coordinates.

# re: Google maps crash IE 10/18/2005 9:01 AM David
Yes, try doing that. Let us know if it works!

# re: Google maps crash IE 11/7/2005 2:35 AM Martin
Many thanks. You just saved me many hours of time.

# re: Google maps crash IE 11/7/2005 8:49 AM David
My pleasesure!

# re: Google maps crash IE 11/11/2005 4:25 PM Pete
I tried moving the entire script to the bottom of the page like Blue suggested. The map shows up now, but I still get the error message. I'm so close, what can I do?

# re: Google maps crash IE 11/11/2005 4:49 PM Pete
This is what finally worked for me. I got this from another forum.
To allow the Google Map API in IE, just turn insert this into your body tag:

onload="mapload();"

then wrap your existing gmap code with:

function mapload() {

}

That should do the trick.


# re: Google maps crash IE 11/13/2005 9:23 PM David
Tnx, Pete!

# re: Google maps crash IE 1/19/2006 5:32 AM Johnny
You are my savior! Although the above mentioned solution cannot be use in creating extension for mediawiki. So I used the Settimeout to slow down the loading of map instead.

# re: Google maps crash IE 1/31/2006 10:41 PM Ben
I received this error also. The way I fixed it was by removing the <center> tags from my site. Apparently this has been depreciated, and Google Maps doesn't like it!

# re: Google maps crash IE 2/27/2006 2:53 PM Deb
So far I have tried various things: the onload and function, putting it just before the end, putting it all in the head, putting all after the body - still nothing works for IE for me, I still get the same error.

# re: Google maps crash IE 4/17/2006 5:58 PM Greg
Thanks Ben for the tip on the <center> tags. Once I removed those my page is running slicker than a greased weasle.

# re: Google maps crash IE 5/13/2006 12:16 AM Wade
Thanks for tip! Mapquest API was having the same problem, & it appears to work for it also.

# re: Google maps crash IE 5/17/2006 8:41 PM Chris
If you've moved the Google Map javascript into the header and are still getting an error, change the version of the Google map you are using to "2.50a". That would be "v=2.50a" in the query string. Good luck!

# re: Google maps crash IE 8/30/2006 12:29 PM Lukas Kohler
I also had to copy the <script language = "JavaScript" type="text/javascript"> ...gmap functions here...</script> after the </body> tag, just before </html> and since the it works fine. See here:
http://cs03.lb.tu-berlin.de/world4all/geoweb/index.php

# re: Google maps crash IE 9/1/2006 2:29 AM Chris Nolan.ca
Thanks for the info, but it wasn't enough to fix the problem for me.

I changed my code to use a setTimeout to delay the call to render the map until after the whole page had been loaded. See full info @ http://chrisnolan.ca/ID/980

# re: Google maps crash IE 10/14/2006 8:00 PM Kaiser
Easiest solution that worked for me, without inserting the API tags outside the HTML..

First, the sample code is:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[

function load_map() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}

//]]>
</script>


Then, where you want your map to appear, you should write:

<div id="map" style="width: 500px; height: 300px"></div>

but, below that, we will add this javascript function to do the trick on the onload method, required for IE to work properly:


<script type="text/javascript">
function WindowOnload(f) {
var prev=window.onload;
window.onload=function(){
if(prev)prev(); f();
}
}

WindowOnload(load_map);
</script>


Just that, it works 100% ;)
(using this short js tutorial I found: http://blog.firetree.net/2005/07/17/javascript-onload/)



# re: Google maps crash IE 10/14/2006 8:59 PM Kaiser
WAAAAAIT! :)
my last post works fine with IE... but stops working on Mozilla..
sorry, you should take a look at this:

http://dean.edwards.name/weblog/2005/09/busted/

This REALLY works on IE, Mozilla, Opera, etc...
This is how applied it:
---------------------------------------------------------

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg" type="text/javascript"></script>
<script type="text/javascript">

//<![CDATA[

function load_map() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}
//]]>


function init_map() {
if (arguments.callee.done) return;
arguments.callee.done = true;
load_map();
};

/* for Mozilla */
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", init_map, false);

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script defer src=ie_onload.js><"+"/script>");
/*@end @*/

/* for other browsers */
window.onload = init_map;

</script>

<div id="map" style="width: 468px; height: 400px; border:1px solid gray;"></div>


# re: Google maps crash IE 12/27/2006 10:06 PM ביטוח רכב
be ware that the zindex attribute is different in the CSS than it is the img tag

# re: Google maps crash IE 2/6/2007 3:01 PM ml
Thanks...you just saved me many a sleepless nights.

# re: Google maps crash IE 2/23/2007 5:32 PM Rob
Thats great thanks!

I used a great onload manager http://simon.incutio.com/archive/2004/05/26/addLoadEvent to do this for me :)

# re: Google maps crash IE 3/26/2007 4:51 PM Carl
Thanks for the tip. My users were complaining about the map locator not working in IE7. I used the w3 validator to get the page to be xhtml 1.0 strict compliant and it still didn't work. Then I moved the script to the end of the page per your suggestion and it works just fine. Thanks again.

Carl

# re: Google maps crash IE 3/26/2007 9:25 PM Matt Browne
Thank you! This was a very aggravating error.

You may also need to move the included Google maps script (script src...) to the <head> section

# re: Google maps crash IE 3/27/2007 10:27 PM David
Glad I was of some help!

# re: Google maps crash IE 6/7/2007 1:06 PM David Gould
Hi,

Please see

http://support.microsoft.com/default.aspx/kb/927917

for further information.

Just thought I'd help.

D.

# re: Google maps crash IE 1/8/2008 11:30 AM hem
HOW TO MOVE THE SCRIPT AFTER BODY TAG.
SCRIPT IS GETTING GENERATED RUN TIME

# re: Google maps crash IE 1/9/2008 8:27 PM Maria
Thank you so much! Moving the code after the body tag solved my problem in IE!

# re: Google maps crash IE 1/16/2008 6:46 AM Lucky
If you have problem to display google map in IE7 than set you IE settings
this works if you got error like GMap2 Undefined
IE7
tool->internet options
sercurity tab->custom level->push reset button
similarly in advance tab
it will start displaying google map


# re: Google maps crash IE 2/18/2008 6:58 PM Appreciative User
Thanks so much. It worked! You are awesome!

# re: Google maps crash IE 4/27/2008 7:21 PM Vanetta
Google maps consistently crashes with my Safari browser
I submit regular reports to Apple who do absolutley nothing about it.

# IE7 crashes when I click on site menu 6/30/2008 11:25 AM Albert
Hi,

I implemented google maps WITHOUT an API with maps.google.de. When I click on my site the menu link for the map the map loads correctly. But when I afterwards click another menu link IE7 crashes.

It would be great if someone could help me.

Thanks in advance.

Albert

# re: Google maps crash IE 7/1/2008 5:32 PM Albert
I found the solution: I took out the polygon, which I don't really need, and then it worked.

Albert

# re: Google maps crash IE 7/7/2008 2:34 PM Geert
Thank you! This post made my day.

# IE error “Operation Aborted” 7/8/2008 8:40 PM Satyadev Singh

Please have a look at the url below, you will get to know the problem and it's solutions.


http://blogs.msdn.com/ie/archive/2008/04/23/what-happened-to-operation-aborted.aspx

http://support.microsoft.com/default.aspx/kb/927917


# re: Google maps crash IE 7/14/2008 8:48 AM Uygar
I clear my browser's cache and problem is gone now...

# re: Google maps crash IE 2/18/2010 7:53 AM Mohamed
Kaiser - Thank you :)

Comments have been closed on this topic.