I am trying to figure out how to get the user's geo-location when a request comes in after they've clicked on a link. Is there a easy way to do this in rails, also is the geo-location provided by the user's browser, or is there another way this is determined?
I am trying to figure out how to get the user's geo-location when a
request comes in after they've clicked on a link. Is there a easy way to
do this in rails, also is the geo-location provided by the user's
browser, or is there another way this is determined?
Thanks!
--
Kind Regards,
Rajinder Yadav
who can get the user geo-location using their IP-Address
I am trying to figure out how to get the user's geo-location when a
request comes in after they've clicked on a link. Is there a easy way to
do this in rails, also is the geo-location provided by the user's
browser, or is there another way this is determined?
You might want to take a look at the html5 geolocation api (
Geolocation API ). The browser will ask the
user for permission, and precision will vary - last time I checked on
my machine Safari used nearby wifi signals to work out its position
(which was pretty good) whereas Firefox just did an ip address thing,
which was out by a hunded miles (and sometimes is completely wrong, eg
if I'm travelling and using a VPN)
That's up to the browser to decide, and you should note that not all
browsers support this api yet (I'd assume IE doesn't, and only recent
version of Safari/Firefox do). If you only need something very coarse
then you could do an ip lookup competely server side - there are
various people who provide apis for that sort of thing.