Google maps API doesn't work in safari

[亡魂溺海] 提交于 2019-12-23 23:39:01

问题


hello im hosting Google maps API on my localhost for now, and it appears fine in Chrome and the mobile phone version. (both safari and chrome iPhone versions).

My problem is Google maps doesn't show when it comes to my Mac version of Safari. the Grey(background) shows and the cursors change to the Google maps cursor, but the map and content doesn't display. what can be the problem?

Here is a link to the map. as you can see the map displays in Chrome but not in safari.(at least not for me).

http://jsbin.com/cahicomame/1/edit?html,output


回答1:


there is no guarantee that navigator.geolocation.getCurrentPosition will return a result. The user may deny the permission or the geolocation-service may not be able to locate the user.

You better initialize the map with a default-center (center is required to display the map).




回答2:


I find the solution after 1 hours , it's because my website (developpement) was in http and not https :) Safari will ask your localisation.



来源:https://stackoverflow.com/questions/35158453/google-maps-api-doesnt-work-in-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!