2017-06-13 52 views
1

我正在为我的应用程序使用AWS服务器。在那里我使用谷歌地图时遇到了一个问题,当我使用localhost来运行我的应用程序谷歌地图确实工作正常,但是当我使用IP地址来运行应用程序时,它不起作用。它给了我这个错误:使用谷歌地图的AWS服务器

getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See for more details.

我该如何解决它?

+0

您的Amazon实例应请https: –

+0

为您的网站获取SSL证书,如果您无法购买,请查看https://letsencrypt.org/,他们会提供免费的SSL证书 –

回答

0

这发生因使用未保护的URL,因此作为一种解决方法,您可以使用 Google maps API ,那么你就可以注册和发送使用POST地理位置请求到以下网址:

"https://www.googleapis.com/geolocation/v1/geolocate?key={{ 
registerd_Key}}"