diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 33b6d30..55872e0 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -11,6 +11,7 @@ export default { return { coordinates: null, loading: false, + locationAccessBlocked: false, } }, @@ -22,13 +23,19 @@ export default { useCurrentLocation() { - if (location.protocol == 'http:') { - alert("Sorry, this only works for secure sites.") + if (this.locationAccessBlocked) { + alert("You must refresh the page first, then try again.") + return } navigator.geolocation.getCurrentPosition(loc => { this.coordinates = `${loc.coords.latitude},${loc.coords.longitude}` this.loadCoordinates() + }, error => { + if (error.code == 1) { // PERMISSION_DENIED + this.locationAccessBlocked = true + } + alert(`error.code = ${error.code}\n\n${error.message}`) }) },