简体   繁体   English

Google Maps API持续加载到控制台中

[英]Google maps api continuously loading in console

I am using google maps API and included below link 我正在使用Google Maps API,并在下面的链接中包含

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>

Below link is continuously loading in console under Net tab in firebug so my browser tab not stopping to show loading icon. 下面的链接不断在控制台中的Firebug的“ Net”选项卡下不断加载,因此我的浏览器选项卡没有停止显示加载图标。

http://mt1.googleapis.com/vt?lyrs=m@207000000&src=apiv3&hl=en-US&x=49&y=97&z=8&s=Gali&style=api|smartmaps http://mt1.googleapis.com/vt?lyrs=m@207000000&src=apiv3&hl=zh-CN&x=49&y=97&z=8&s=Gali&style=api|smartmaps

This usually may happen only when you initialize the map before the window has finished loading. 通常只有在窗口加载完成之前初始化地图时,才会发生这种情况。

So my first suggestion would be to initialize the map on window.onload 所以我的第一个建议是在window.onload上初始化地图
When this is not the case in your implementation and you already initialize the map onload, you may call 如果实现中不是这种情况,并且您已经初始化了地图加载,则可以调用

window.stop() 

...immediately before you initialize the map. ...在初始化地图之前立即进行。

But Note: this will stop all active loading-processes for any ressources, it's exactly the same behaviour as when you press the browsers stop-button or ESC . 但是请注意:这将停止所有资源的所有活动加载过程,其行为与您按浏览器的停止按钮或ESC完全相同。

Strange! 奇怪! I tried it in Firefox and works fine, and it completes loading. 我在Firefox中对其进行了尝试,并且工作正常,并且可以完成加载。 It may have something to do with loading a cached copy, try clearing your cache and then loading again. 它可能与加载缓存的副本,尝试清除缓存然后再次加载有关。

I wouldn't suggest window.stop() just yet, use it as a last resort. 我暂时不建议window.stop() ,将其用作最后的手段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM