DrizzyDrake
DrizzyDrake
Explore posts from servers
KPCKevin Powell - Community
Created by DrizzyDrake on 7/30/2023 in #front-end
JS Geolocation provider did not provide a good position
Uhh so I implemented code a while back that used geolocation and it worked then but now it throws a GeolocationPositionError that the message is Network location provider at 'https://inference.location.live.net/' : Did not provide a good position fix. with error code 2. This is a snippet of the code (yes, the code runs after user input):
let latLong = [0, 0];
latLong = await new Promise(async (res, rej) => {
await navigator.geolocation.getCurrentPosition(
(ret) => {
res([ret.coords.latitude, ret.coords.longitude]);
},
(err) => {
rej(err);
});
});
console.log('latlng', latLong);
let latLong = [0, 0];
latLong = await new Promise(async (res, rej) => {
await navigator.geolocation.getCurrentPosition(
(ret) => {
res([ret.coords.latitude, ret.coords.longitude]);
},
(err) => {
rej(err);
});
});
console.log('latlng', latLong);
2 replies