# Determining link geo-location

**URL:** <https://www.ruby-forum.com/t/determining-link-geo-location/193712>\
**Category:** Rails\
**Created:** [August 23, 2010, 2:46am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712 "2010-08-23T02:46:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajinder\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Post date:** [August 23, 2010, 2:46am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712/1 "2010-08-23T02:46:30Z")

</div>

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 Y.

---

<div class="post-metadata">

**Author:** ![Rajinder\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Post date:** [August 23, 2010, 11:26am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712/2 "2010-08-23T11:26:30Z")

</div>

Rajinder Y. wrote:

> 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 Y.

who can get the user geo-location using their IP-Address

---

<div class="post-metadata">

**Author:** ![Rajinder\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Post date:** [August 23, 2010, 11:33am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712/3 "2010-08-23T11:33:19Z")

</div>

On Aug 23, 1:45 am, Rajinder Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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](http://dev.w3.org/geo/api/spec-source.html) ). 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)

Fred

---

<div class="post-metadata">

**Author:** ![Rajinder\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Post date:** [August 24, 2010, 10:18am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712/4 "2010-08-24T10:18:05Z")

</div>

On Aug 24, 1:23 am, Rajinder Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 10-08-23 05:32 AM, Frederick C. wrote:

> Hi Fred,
> 
> thanks for that info, for my use case a general location of the user,  
> like country and possibly region or city will do!
> 
> Q: About obtaining permission from the user, this needs to be done easy  
> time? Thanks!

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.

Fred

---

<div class="post-metadata">

**Author:** ![Rajinder\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Post date:** [August 24, 2010, 2:24am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712/5 "2010-08-24T02:24:30Z")

</div>

On 10-08-23 05:32 AM, Frederick C. wrote:

> [Geolocation API](http://dev.w3.org/geo/api/spec-source.html) ). 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)
> 
> Fred
> 
> > Thanks!

Hi Fred,

thanks for that info, for my use case a general location of the user,  
like country and possibly region or city will do!

Q: About obtaining permission from the user, this needs to be done easy  
time? Thanks!

–  
Kind Regards,  
Rajinder Y.

---

<div class="post-metadata">

**Author:** ![Rajinder\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rajinder\_Y](https://www.ruby-forum.com/u/Rajinder_Y)\
**Post date:** [August 26, 2010, 9:36am UTC](https://www.ruby-forum.com/t/determining-link-geo-location/193712/6 "2010-08-26T09:36:58Z")

</div>

On 10-08-24 04:17 AM, Frederick C. wrote:

> > Q: About obtaining permission from the user, this needs to be done easy  
> > time? Thanks!
> 
> 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.
> 
> Fred

Fred, thanks I got something working right now with an IP geo lookup.

–  
Kind Regards,  
Rajinder Y.
