本文介紹了如何通過電子應(yīng)用程序中的 navigator.geolocation 獲取當(dāng)前位置?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問題描述
當(dāng)我嘗試獲取當(dāng)前位置時(shí)
When I try to get the current position
navigator.geolocation.getCurrentPosition(handleCoordinates, handleError, {timeout:10000})
返回
'https://www.googleapis.com/' 的網(wǎng)絡(luò)位置提供商:返回錯(cuò)誤代碼 400."
"Network location provider at 'https://www.googleapis.com/' : Returned error code 400."
有人可以提出任何可能的方法嗎?
Can somebody suggest any possible ways?
推薦答案
你應(yīng)該配置正確的 google api key 來(lái)請(qǐng)求 chrome 中的 google 相關(guān)服務(wù).
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
這篇關(guān)于如何通過電子應(yīng)用程序中的 navigator.geolocation 獲取當(dāng)前位置?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!