开发者

GWT : User Location

In GWT, is there a way to find开发者_如何学编程 out the user's physical location (country, state etc)?


You can use HTML 5's geolocation feature in GWT using the Geolocation API provided by the gwt-mobile-webkit project.

edit: This feature is now included in the GWT SDK itself. See the geolocation package.

You'll only be able to use this on browsers that support this fairly new feature, though.


A safer bet than HTML5's geolocation feature is GeoLite City from MaxMind, a free (and slitghly less accurate) version of their GeoIP City product.
They offer APIs for various languages - I'm sure you'll find one that fits your server side :)


If I were you I would use the HTML5 geolocation API. One of the procject's that you could use is the already mentioned gwt-mobile-webkit. If you need a solution that would be of a benefit to more users you could use a revers ip lookup. Use the following link to see one of the companies that provides reverse ip lookup.

http://www.ip2location.com/

Just to say one more - if you can afford to lose some of your users, or just cripple them, go for HTML5.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜