本文介紹了如何通過電子應用程序中的 navigator.geolocation 獲取當前位置?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
當我嘗試獲取當前位置時
When I try to get the current position
navigator.geolocation.getCurrentPosition(handleCoordinates, handleError, {timeout:10000})
返回
'https://www.googleapis.com/' 的網絡位置提供商:返回錯誤代碼 400."
"Network location provider at 'https://www.googleapis.com/' : Returned error code 400."
有人可以提出任何可能的方法嗎?
Can somebody suggest any possible ways?
推薦答案
你應該配置正確的 google api key 來請求 chrome 中的 google 相關服務.
You should configure correct google api key to request google related services in chromium.
https://github.com/electron/electron/blob/master/docs/api/environment-variables.md#google_api_key
https://github.com/electron/electron/issues/9420
這篇關于如何通過電子應用程序中的 navigator.geolocation 獲取當前位置?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!