How to getCurrentPosition via navigator.geolocatio

2019-07-31 10:12发布

问题:

When I try to get the current position

navigator.geolocation.getCurrentPosition(handleCoordinates, handleError, {timeout:10000})

it returns

"Network location provider at 'https://www.googleapis.com/' : Returned error code 400."

Can somebody suggest any possible ways?

回答1:

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