This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes get location of client? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "get location of client?" Watch "get location of client?" New topic
Author

get location of client?

pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 362

Hi All,

I have a requirement where I need to fetch location of the client and according to that I need to display weather information.

Can I do this? If yes then kindly let me know.


Pawan Chopra
SCJP - DuMmIeS mInD
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You can't do it with 100 % accuracy, because a client can be hosted from a server on the other side of the World.

One way is to use one of the "find my IP address" sites, and then find the right location information in the returned source code - another way is to map the clients IP-adr. to a home made database of each IP-adr. groups for the all Countries/Continents of the World.


Regards, Rene Larsen
Dropbox Invite
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

We can't get the actual location of the client with IP address, He/She may be in local address with NAT.


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: get location of client?
 
Similar Threads
How to use put verb with ajax
Copying a file using http
Prompt for location when file is downloading
Client Location
related to Log4J