user900721
user900721

Reputation: 1437

How to get Geographical location from Browser in java

I am working on the sample application and it need to put Geographical location in logs. Is there any API, or method that enable use to get the Geographical location from Browser in java.

Please advise if any.

Thanks

Upvotes: 0

Views: 1431

Answers (1)

Santosh
Santosh

Reputation: 17923

There are two ways you can accomplish this. Both of these relay on the fact that you know the remote client IP address.

  1. Have the Geo-location database downloaded locally and query this based on the IP addressed of the client received. Geolite is one such database and its updated regularly.
  2. Subscribe to some online service like GeoLoc which return the location in an XML format based on the IP address passed.

Upvotes: 2

Related Questions