views:

10

answers:

1

I've created a SharePoint 2010 WebPart that pulls lat/long info from a list and displays pins in a map. I'm having a problem where the map does not render properly in IE7. Even when I'm not using any pins and just showing a basic map. Here's a screenshot: Screenshot

I've simplified the code as much as possible and am still getting the error. here's my sample code:

<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"&gt;&lt;/script&gt;
<div id='rowanMap' style="position:relative; width:100%; height:400px; float:none;"></div>
<script type="text/javascript">
 function GetMap() {
  var map = null;
  map = new VEMap('rowanMap');
  map.SetCredentials("[Redacted]");

// pins added programatically here if they exist, but problem occurs without them as well.

  map.LoadMap();
 }

 GetMap();
</script>

This is being added to the page as a visual webpart.

I know it's not my version of ie7, because this demo works when loaded in a second tab: http://www.microsoft.com/maps/isdk/ajax/

Again, firefox, chrome, ie8, ie9 all work properly.

Any ideas?

A: 

I figured out a workaround. It seems that the problem is that the getmap() function runs before the page finishes loading, so adding a timeout solves the problem:

 setTimeout("GetMap()", 50); 

I tried using the window.onload method, but it overwrote some necessary sharepoint javascript. Luckily the timeout works even when it is very short.

Derrick Bowen