简体   繁体   English

单张地图-有时显示,有时不显示,为什么?

[英]Leaflet map — sometimes it shows, sometimes it doesn't, any idea why?

Firefox 24.0 and the most recent Chrome both seem to refuse to load my leaflet map...but low and below -- it loads on Safari on my Iphone (not useful, but interesting to note). Firefox 24.0和最新的Chrome似乎都拒绝加载我的传单地图...但是低于和低于它-在Iphone的Safari上加载(没有用,但需要注意)。

This is my first stab at Leaflet and Bootstrap...other then the .container working unpredictably when I called it from localhost...I haven't had any problems until I tried to load it onto a webpage... 这是我在Leaflet和Bootstrap上的第一个刺...其他的.container在我从本地主机调用时无法正常工作...直到尝试将其加载到网页上之前我没有任何问题...

I am mostly curious why this is, I haven't seen something like this before... 我很好奇为什么会这样,我之前从未见过类似的东西...

Thanks! 谢谢!

Site: Link to Leaflet Map 网站: 链接到传单地图

Any thoughts maybe? 有什么想法吗?

Ok the issue is probably related to cdn and security. 好的,问题可能与CDN和安全性有关。 When I open your sample site in Chrome it gives me a warning that a script is being loaded from unauthoriced sources. 当我在Chrome中打开示例网站时,它会警告正在从未经授权的来源加载脚本。

Since FF23 these scripts are also blocked directly in the browser, and you get error messages as such: 由于FF23,这些脚本也直接在浏览器中被阻止,并且您会收到如下错误消息:

Blocked loading mixed active content "http://code.jquery.com/jquery-1.10.1.min.js"

When I allowed to load unauthorized scripts in chrome, (there is a little shield icon in the address bar) it worked without a problem! 当我允许在chrome中加载未经授权的脚本时(地址栏中有一个小盾图标),它可以正常工作!

So try to provide these scripts locally, it might have something to do with google drive, that it is more restrictive because of javascript threats as such. 因此,请尝试在本地提供这些脚本, 这可能与Google驱动器有关,由于存在诸如JavaScript之类的威胁,因此限制性更强。

I hope it helped, and if you think this is the solution please mark it as an answer. 希望对您有所帮助,如果您认为这是解决方案,请标记为答案。

Thanks 谢谢

You are loading leaflet.js before jquery, I get 9 js errors on the page. 您在jquery之前加载leaflet.js,页面上出现9个js错误。

One of them says: 其中一位说:

ReferenceError: jQuery is not defined ReferenceError:jQuery未定义

Is leaflet dependend on jquery? 传单依赖于jquery吗? Then you should load it first... 然后,您应该先加载它...

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>    
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

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

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