Reputation: 1
window.addEventListener("load", () => {
let lat;
let long;
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(position => {
console.log(position);
})
}
})
Error : [Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS.
Upvotes: 0
Views: 279
Reputation: 922
getCurrentPosition()
is blocked on non-secure protocols in Chrome and other browsers for security reasons. You need to install SSL Certificate
Upvotes: 0