Harpreet Singh
Harpreet Singh

Reputation: 99

current location is not accurate using getCurrentPosition

Unable to get accurate location its giving location but its different from my current location.

This is the url where i implemented https://www.w3schools.com/html/html5_geolocation.asp

if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition((position) => {
          
          // this.showPosition(position);
              console.log("swd",position.coords)

        });
      }

Upvotes: 0

Views: 275

Answers (1)

holtc
holtc

Reputation: 1820

As it says on that page, Note: Geolocation is most accurate for devices with GPS, like smartphones., so if you're not on a device with GPS, it probably is going based on your IP address, which isn't necessarily the most accurate if you're on a corporate/university network or behind any sort of proxy

Upvotes: 1

Related Questions