簡體   English   中英

必應地圖未加載

[英]Bing maps not loading

我使用此html加載bing映射腳本:

<html><head>
    <script src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1"     type="application/javascript" ></script>
</head><body></body></html>

在firefox中:腳本加載並在頭部添加另一個腳本標簽,然后加載第二個腳本(可以在firebug的“ Net”選項卡中看到):

<html><head>
    <script src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1"     type="application/javascript" ></script>
    <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/v7.0/7.0.20140904153057.64/js/en-us/veapicore.js">
</head><body></body></html>

在phantomjs:我鈎到page.onResourceRequested並打印請求的URL。 結果是僅請求了第一個腳本,由於我未知的原因而未請求veapicore.js。

這是怎么回事

我相信這與RequireJS一樣。 在Web瀏覽器中,當您動態加載腳本時,如果腳本位於其他域中,則無法動態加載其他腳本。 這是安全的事情。

只需像平常一樣加載腳本標簽,或查看此博客文章: http : //rbrundritt.wordpress.com/2011/11/20/bing-maps-v7-control-lazy-loader/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM