Reputation: 558
On the client side, I can get the location with Javascript by "navigator.geolocation.getCurrentPosition"
https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation
But I have to have the user permission for location
On the server side, I can get the location with just by the IP address, and I don't need the user permission
So Is it true that the location gotten by JavaScript is more accurate than the location gotten by IP address?
Upvotes: 0
Views: 459
Reputation: 100
The HTML5/W3C location API works well if your device is a smartphone and the app ("user agent") is a modern browser. Discussion here: Is W3C Geolocation API more accurate the IP geolocation for non-mobile devices?
For many other use cases, IP geolocation APIs are a good bet for approximate location needs, at country and city levels.
Upvotes: 1