Are you looking for where the user is at the moment or for something more like the users language/nationallity? For the latter you could always look at what's in navigator.language
. Depending on target platform it'll give you either just language code ('en' on my Android test machine) or language code and country code ('en-us' on my iOS test machine). To see what it will give you, go with your device's stock browser here and type in navigator.language
in the text input box.
否则,请随意浏览似乎表明您需要使用网络服务或打包带有代码的数据文件在应用程序。 似乎是一个相当不错的。
Otherwise, casual browsing of the HTML5 Geolocation spec seems to indicate that you'll either need a web-service or package a datafile with codes in the app. This seems to be a pretty good one.
这篇关于Phonegap - 从用户发现国家iso代码的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!