About the author

The author is just another obsessive compulsive hacker (the good kind) who when confronted with anything new can't help but wonder "how'd they do that?!?"

By day, I'm the Software Architect for CBMC; by night, I just try to "keep the clients happy" as Director of Technology for sdgInteractive.


MCPD

RSS Feed

Virtual Earth and Firefox

by hilkiah 26. March 2007 21:03

I've been playing around some more with Virtual Earth and have continued to run into weird "uncaught exception" errors when doing anything more advanced than displaying a map in Firefox. In a previous post, I mentioned that I'd found a workaround for the onMapLoad callback not working correctly. After doing some more research on these new issues, however, I think I've finally discovered the more basic reason this is happening. Apparently, the current version of the VE library doesn't detect the FireFox version correctly. ViaVirtualEarth mentions this workaround which seems to have done the trick for me!

// If the browser is Firefox get the version number 
var ffv = 0;
var ffn = "Firefox/"
var ffp = navigator.userAgent.indexOf(ffn);

if (ffp != -1) {
    ffv = parseFloat(navigator.userAgent.substring(ffp + ffn.length));
}

// If we're using Firefox 1.5 or above override the Virtual Earth drawing functions to use SVG 
if (ffv >= 1.5) {
    Msn.Drawing.Graphic.CreateGraphic = function(f, b) {
        return new Msn.Drawing.SVGGraphic(f, b);
    }
}
// Put your own code below this line 
map = new VEMap('map'); 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Technology | Web Development