const geolocation = (e) => {
e.preventDefault();
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(success) => {
const { latitude, longitude } = success.coords;
setCordinates({ latitude, longitude });
setL_status(true);
},
(error) => {
alert("Something went wrong in the process of grabbing location: " + error.message);
// Check if the user is on an Android device
}
);
} else {
alert("Geolocation is not supported by your browser.");
}
};
This is my function to get coordinates of the user, but in Android browsers, I get this error:
only secure origin are allowed
Please help me solve this error