All entries for Thursday 23 August 2007

August 23, 2007

GoogleMaps Operation Aborted in Internet Explorer 6

If you get an Operation Aborted error when trying to get GoogleMaps to work in IE6, try moving the SCRIPT tags into the BODY section. The error is occuring due to IE6’s dodgy handling of the BASE tag. You could also just remove the BASE tag if you don’t need it for anything else.


Add XML namespace outside of HTML tag

This post is purely for Google’s benefit.

I was trying to find a way of enabling VML in IE without changing the HTML tag and after a lot of searching could not find anything. Turns out it is relatively simple in JavaScript with the following code (totally stolen):

var tmp = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
if(tmp) var isIE = document.namespaces ? 1 : 0;

if(isIE) {
     if(document.namespaces['v'] == null) { 
          var stl = document.createStyleSheet(); 
          stl.addRule("v\\:*", "behavior: url(#default#VML);"); 
          document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); 
     }
}

Hopefully this will help someone else will save themselves some time.