Bing 地图控件无法在 IE7 中正确呈现 - SharePoint 2010
我创建了一个 SharePoint 2010 WebPart,它从列表中提取纬度/经度信息并在地图中显示图钉。我遇到了地图在 IE7 中无法正确渲染的问题。即使我没有使用任何图钉并且只显示基本地图。这是屏幕截图:屏幕截图
我已尽可能简化了代码,但仍然收到错误。这是我的示例代码:
<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>
这将作为可视 Web 部件添加到页面中。
我知道这不是我的 ie7 版本,因为这个演示在第二个选项卡中加载时可以工作: http: //www.microsoft.com/maps/isdk/ajax/
同样,firefox、chrome、ie8、ie9 都可以正常工作。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出了一个解决方法。看来问题在于 getmap() 函数在页面完成加载之前运行,因此添加超时解决了问题:
我尝试使用 window.onload 方法,但它覆盖了一些必要的 sharepoint javascript。幸运的是,即使超时很短,它仍然有效。
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:
I tried using the window.onload method, but it overwrote some necessary sharepoint javascript. Luckily the timeout works even when it is very short.