i am developing a product where i need to know from wich country the
user is logged in .! and display things according to his geolocation .
can any one please help me out with this
Rajesh B. wrote in post #974156:
i am developing a product where i need to know from wich country the
user is logged in .! and display things according to his geolocation .
can any one please help me out with this
Perhaps you want to use the new HTML 5 geolocation features. If not,
Google has a similar API available to the public. This is an HTML/JS
issue and has nothing to do with Rails.
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
Sent from my iPhone
Thanks Marnen.
On Jan 12, 2011, at 7:43 AM, Marnen Laibow-Koser wrote:
Rajesh B. wrote in post #974156:
i am developing a product where i need to know from wich country the
user is logged in .! and display things according to his geolocation .
can any one please help me out with this
Great! Geolocation is always fun.
Perhaps you want to use the new HTML 5 geolocation features. If not,
Google has a similar API available to the public. This is an HTML/JS
issue and has nothing to do with Rails.
You may be correct in this statement, but there’s also the option of
segmenting the content on the server side. I.e., in Rails. It can
arguably also be a nice attribute to have on a user model for future
send-outs or similar.
Have a look at GitHub - cjheath/geoip: The Ruby gem for querying Maxmind.com's GeoIP database, which returns the geographic location of a server given its IP address. Then check out
Industry leading IP Geolocation databases and web services | MaxMind.
Good luck.
Didde B. wrote in post #974306:
On Jan 12, 2011, at 7:43 AM, Marnen Laibow-Koser wrote:
Rajesh B. wrote in post #974156:
i am developing a product where i need to know from wich country the
user is logged in .! and display things according to his geolocation .
can any one please help me out with thisGreat! Geolocation is always fun.
Perhaps you want to use the new HTML 5 geolocation features. If not,
Google has a similar API available to the public. This is an HTML/JS
issue and has nothing to do with Rails.You may be correct in this statement, but there’s also the option of
segmenting the content on the server side. I.e., in Rails.
Well, of course Rails should deal with the data once acquired. But
acquiring the user’s location is a job for the client side, isn’t it?
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
On Jan 12, 2011, at 5:07 PM, Marnen Laibow-Koser wrote:
Perhaps you want to use the new HTML 5 geolocation features. If not,
Google has a similar API available to the public. This is an HTML/JS
issue and has nothing to do with Rails.You may be correct in this statement, but there’s also the option of
segmenting the content on the server side. I.e., in Rails.Well, of course Rails should deal with the data once acquired. But
acquiring the user’s location is a job for the client side, isn’t it?
I’m not so sure. It depends on the use case, IMHO.
For example. Say you have http://www.mysite.com/ which needs to redirect
the visitor to http://www.mysite.co.uk/ if the originating IP resolves
to the UK. Using your method, a page would need to load, determine the
geographical location and then use meta refresh or a Javascript in order
to perform the actual redirect.
Using GeoIP on the server side, a redirect_to in the controller could
take care of it all in one quick action.
But again, it all depends on what you need to do. If it’s a matter of
simply varying some sort of UI element, the client side way makes sense.
Your mileage may vary
On Wed, Jan 12, 2011 at 8:33 AM, Didde B. [email protected]
wrote:
I’m not so sure. It depends on the use case, IMHO.
+1
If the OP only needs the country identified, GeoIP on the server is
the easiest solution.
For any finer granularity, GeoIP (or any IP-based system) is not very
reliable. (At the moment I’m in a moving vehicle south of Pismo Beach
California, and GeoIP thinks I’m in Manteca – way off.)
But the client-side solutions are still a work in progress too, AFAICT
FWIW,
Hassan S. ------------------------ [email protected]
twitter: @hassan
Hi, if you want to maintain the data yourself then you might want to
consider of getting the data from geolocation providers. We use
IP2Location and I think there have Ruby solution available too. Try
IP2Location IP Geolocation Ruby Library | IP2Location.
Thanks all