谷歌地图需要很长时间才能在ie11中渲染
Google maps taking a long time to render in ie11
附加的HTML在Chrome和Mozzilla浏览器中呈现速度非常快。如果我试图在IE11中加载它,我会遇到几个超时错误,30秒后,地图最终呈现出来。
我在IE11中尝试了各种设置,但没有成功。当我在调试器模式下使用开发人员工具运行时。我明白错误InvalidValueError:不是以下函数中的字符串3次
function wf(a,b){return function(c){if(a(c))return c;throw qf(b||""+c);}}function xf(a){var b=arguments;return function(a){for(var d=[],e=0,f=b[H];e<f;++e){var g=b[e];try{(g.Ff||g)(a)}catch(h){if(!(h instanceof pf))throw h;d[F](h.message);continue}return(g.then||g)(a)}throw qf(d[rd]("; and "));}}function yf(a,b){return function(c){return b(a(c))}}function zf(a){return function(b){return null==b?b:a(b)}}function Af(a){return function(b){if(b&&null!=b[a])return b;throw qf("no "+a+" property");}}
在按下F5继续三次之后,MAP最终渲染。
这是HTML。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2010 Google Inc.
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
-->
<!-- saved from url=(0016)http://localhost -->
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Google Maps JavaScript API v3 Example: Optimized Directions</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
var origin = " 1837 N. Kinser Pike, Bloomington, IN 47404 ";
var destination = " 520 W NORTHLANE DR, BLOOMINGTON IN 47404 ";
var waypoints = [];
var markers = [];
var directionsVisible = false;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var store = new google.maps.LatLng(35.930251, -86.824265);
var myOptions = {
zoom:14,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: store,
panControl: true,
zoomControl: true,
scaleControl: true
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
calcRoute();
}
function addMarker(latlng) {
markers.push(new google.maps.Marker({
position: latlng,
map: map,
icon: "http://maps.google.com/mapfiles/marker" + String.fromCharCode(markers.length + 65) + ".png"
}));
}
function calcRoute() {
if (origin == null) {
alert("Click on the map to add a start point");
return;
}
if (destination == null) {
alert("Click on the map to add an end point");
return;
}
var request = {
origin: origin,
destination: destination,
waypoints: waypoints,
travelMode: google.maps.DirectionsTravelMode.DRIVING,
optimizeWaypoints: true,
avoidHighways: true,
avoidTolls: true
};
directionsService.route(request, function(directionsresult, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(directionsresult);
}
});
directionsVisible = true;
}
function updateMode() {
if (directionsVisible) {
calcRoute();
}
}
function printTextDirections() {
for (var i = 0; i < directionsresult.routes.length; i++) {
for (var j = 0; j < directionsresult[i].legs.length; j++) {
alert(directionsresult.routes[i].legs[j]);
}
}
}
</script>
</head>
<body onload="initialize()" style="font-family: sans-serif;">
<div id='map_canvas' style='width: 65%; height: 580px; float:left; border: 1px solid black;'></div>
<div id='directionsPanel' style='width: 30%; height:580px; float:right; border; 1px solid black;'></div>
</body>
</html>
我在3.19指定了谷歌地图版本,问题得到了解决。
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.19"></script>
我得到的是实验版本,因为我没有指定版本。
相关文章:
- 为什么我的上下文选择器和.buttonset()在ie中花费了这么长时间
- 谷歌地图需要很长时间才能在ie11中渲染
- 有没有一种方法可以检查javascript以毫秒为单位执行一个函数需要多长时间
- 我一直收到的控制台警告是什么?推迟长时间运行的计时器任务以提高滚动的流畅性
- 为什么这个代码不起作用?我花了很长时间试图弄清楚这一点
- 如何在长时间执行JavaScript期间显示微调器
- 长时间轮询:每个浏览器中的通知
- 完整日历:如何支持一次点击和不长时间点击
- 如何使用 javascript 停止对 asp.net 进行正在进行的回发(长时间运行的执行)
- 为什么这个 AJAX 调用需要这么长时间
- 为什么这个正则表达式需要这么长时间才能执行
- 如何修复长时间运行的脚本
- Node.js中的垃圾收集作用域-变量将保持设置状态多长时间
- javascript秒表限制最长时间
- 长时间运行的脚本IE与Chrome/Firefox
- 有没有一种方法可以在长时间运行的JavaScript操作之前强制回流
- 我的无引用 JavaScript 对象存在在哪里以及存在多长时间
- 为什么chromecast在动画帧之间需要这么长时间
- 输入焦点关闭键盘,需要长时间触摸
- AngularJS:在长时间循环期间强制更新DOM(即进度指示器)