Kavya Mehra
Kavya Mehra

Reputation: 1

getCurrentPosition() is not working on google chrome

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

Answers (1)

pierre-lgb
pierre-lgb

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

Related Questions