开发者

Bing maps control not rendering properly in IE7 - SharePoint 2010

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"></script>
<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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜