我长期以来一直在我的项目中导入 Google Maps API:
<script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?libraries=places,geometry&sensor=false&language=fr" ></script>
此脚本尝试加载 3 个库:
https://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/intl/fr_ALL/main.js
https://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/intl/fr_ALL/geometry.js
https://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/intl/fr_ALL/places.js
但是全部失败,并返回404
没有 https 的相同脚本可以正常工作,但问题直到 1 ou 2 天..
<script type="text/javascript" src="http://maps-api-ssl.google.com/maps/api/js?libraries=places,geometry&sensor=false&language=fr" ></script>
直接打电话
http://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/intl/fr_ALL/main.js
http://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/intl/fr_ALL/geometry.js
http://maps-api-ssl.google.com/maps-api-v3/api/js/21/9/intl/fr_ALL/places.js
你知道为什么吗?
最佳答案
尽管使用 en_GB 版本,但我在该 url 上的 map api 上遇到了同样的问题。直到昨晚为止都还好好的。我通过调用 google api 教程上的 url https://developers.google.com/maps/documentation/javascript/tutorial 修复了它。
所以代替:
<script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?libraries=places,geometry&sensor=false&language=fr" ></script>
你可以尝试:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places,geometry&sensor=false&language=fr" ></script>
关于javascript - Google map 库 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31828596/