Using the Virtual Earth v2 control in Firefox
Posted by admin, Fri Feb 24 10:27:13 UTC 2006
So, you’ve started using the Virtual Earth v2 control, and discovered… it doesn’t quite work right in Firefox, does it? Of course, this blog from last week notes that you need a “wedge” in order to make it work right… but it’s not official.
Virtual Earth
As many of you have pointed out to me, the v2 control does not support firefox as well as the Windows Live Local site does. There is actually a wedge you can put in place to fix most of these issues, but it is not officially part of the SDK today.
I find it vaguely amusing that I did a “view page source” on local.live.com the same week it was released (back in DECEMBER), and found the “wedge”, and have been using it ever since… I guess three months isn’t too far behind… (sigh).
But you know what? Firefox still didn’t work right for my map. I was following this example:
Via Virtual Earth
Creating Your First Virtual Earth v2 Page (Part 1)
And I discovered that it worked ok in IE, but in Firefox the map spread out all over the page, instead of staying inside its nicely size-limited div. This was a big problem for me. All of my page header graphics disappear under the map, and all my navigation links were practically invisible (on an aerial map).
But yesterday, I discovered this example.
Virtual Earth: Tutorial Part 1 – AJAX and Virtual Earth
Tutorial Part 1 – AJAX and Virtual Earth
And wouldn’t you know…? It looked just fine in Firefox. Grrr.
So I pulled out “view page source” again, and eventually discovered the difference. I say eventually because I couldn’t believe it the first couple of tries (that can’t be it!). Anyway, if you have the uncontained Virtual Earth map problem in Firefox, all you need to do is add “position:relative” to the style attribute of the containing div, and you are good to go.
Too bad it still doesn’t work in Safari, though :-(