2017-06-13 55 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}}"