How to find the geoip location for all users in Nodejs(如何在 Nodejs 中查找所有用户的 geoip 位置)
问题描述
我有一个要求,我必须找到用户的 geoip 位置.我已经使用了将用户地址存储在数据库中的代码,然后显示该用户的 geoip 位置.现在假设用户将他的位置更改为其他地方.如果用户现在从该地区或国家登录,如何我应该显示该用户的 geoip.我使用的代码是:
I have a requirement where i have to find the geoip location of the users. I have used the code where i store the address of the user in database and then display the geoip location of that user.Now suppose the users changed his location to some other place.If the user now logs in from that region or country, how should i display the geoip of that user. The code that i use is:
geo.geocoder(geo.google, address, sensor,function(formattedAddress, latitude, longitude) {
console.log("Formatted Address: " + formattedAddress);
console.log("Latitude: " + latitude);
console.log("Longitude: " + longitude);
user.latitude = latitude;
user.longitude = longitude;
user.save(function(err) {
if(err)
return userUpdateFailed();
req.flash('info', 'Succesfully Upadated Changes');
res.redirect('/userinfo');
});
});
有没有其他方法可以找到用户的确切位置.请帮助
Is there any alternative wherby i can be able to find the exact location of user.Please help
推荐答案
Node-GeoIP 可以是一种解决方案,但请记住,基于 ip 的地理定位并不总是真实的.
Node-GeoIP could be a solution but keep in mind that ip-based geolocalization isn't always truthful.
这篇关于如何在 Nodejs 中查找所有用户的 geoip 位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Nodejs 中查找所有用户的 geoip 位置
基础教程推荐
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
