getCurrentPosition on chrome breaks javascript

匿名 (未验证) 提交于 2019-12-03 01:25:01

问题:

I have a page where I am loading google maps. I use getCurrentPosition over http and even I receive a warning from google api. The problem is that it breaks also the javascript and that ruins everything. The code was working for quite some time but the last week things broke.

Below is the html and script. You can add it in html and run it and see (tried with stackoverflow but had some issues with the script)

     
eller... Search near you

回答1:

getCurrentLocation is only supported over https:// now on Chrome.

There has been a warning in place in the javascript console in Chrome for quite a while, and it was announced a while ago.

reference from your comment

Starting with Chrome 50, Chrome no longer supports obtaining the user’s location using the HTML5 Geolocation API from pages delivered by non-secure connections. This means that the page that’s making the Geolocation API call must be served from a secure context such as HTTPS.



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