You ask for permissions first:
https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API/Using_the_Permissions_API
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi!
Have created a wepage laravel8.x / vue That gives me my position
Working fine localy, but not when i start my webpage on my server
Get this error message on my iphone:
no position access
My vue page
<template>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2>Min posisjon:</h2>
<p style="color:white;">{{ myCoordinates.lat }} Latitude, {{ myCoordinates.lng }} Longitude</p>
</div>
<div class="col-md-12">
<h2>Map coordinates:</h2>
<p style="color:white;">{{ mapCoordinates.lat }} Latitude, {{ mapCoordinates.lng }} Longitude</p>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
myCoordinates: {
lat: 0,
lng: 0
},
zoom: 10
}
},
created() {
// does the user have a saved center? use it instead of the default
if(localStorage.center) {
let center = JSON.parse(localStorage.center);
this.myCoordinates = {
lat: parseFloat(center.lat),
lng: parseFloat(center.lng)
}
} else {
// get user's coordinates from browser request
this.$getLocation({})
.then(coordinates => {
this.myCoordinates = coordinates;
})
.catch(error => alert(error));
}
// does the user have a saved zoom? use it instead of the default
if(localStorage.zoom) {
this.zoom = parseInt(localStorage.zoom);
}
},
methods: {
handleDrag() {
// get center and zoom level, store in localstorage
console.log("handleDrag");
let center = {
lat: this.map.getCenter().lat().toFixed(4),
lng: this.map.getCenter().lng().toFixed(4)
};
console.log(center.lat);
let zoom = this.map.getZoom();
localStorage.center = JSON.stringify(center);
localStorage.zoom = zoom;
}
},
computed: {
mapCoordinates() {
if(!this.map) {
console.log("MAPCOORDINATES");
return {
lat: 0,
lng: 0
};
}
console.log("mapCoordinates HER");
return {
lat: this.map.getCenter().lat().toFixed(4),
lng: this.map.getCenter().lng().toFixed(4)
}
}
}
}
</script>
How can i get access, to get my possition ?
@martinbean Hi! Think the problem is rhat it dosent ask for permission to use geolocation. If It do that, it will work
Please or to participate in this conversation.