Virtual Earth & JavaScript Frameworks

Today I was working with some guys who are using the JavaScript Framework MooTools and ran into some problems. Since similar errors might occur not just with MooTools but with other Frameworks as well: here is the problem and the solution:

The Problem

Everything worked fine in Internet Explorer but there were some problems when using Firefox: The text of the Virtual Earth Dashboard was stripped out…

FF01

…and Firebug showed some errors whenever the build-in Virtual Earth event MouseEnter or MouseLeave fired.

Well, the problem is caused by a property "contains" in the "String"-object which coincidently had the same name as a function in the Virtual Earth MapControl. In Virtual Earth this function is part of the atlascompat.js script which is pulled behind the scenes from the Virtual Earth MapControl and not used in Internet Explorer at all.

The Solution

The solution is very simple. Make sure you load the Virtual Earth MapControl BEFORE the JavaScript Framework.

    <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6" type="text/javascript"></script>
    <script src="JS/mootools-release-1.11.js" type="text/javascript"></script>

FF02 

Advertisements
This entry was posted in Virtual Earth. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s