問題描述
我有一個要求,我必須找到用戶的 geoip 位置.我已經(jīng)使用了將用戶地址存儲在數(shù)據(jù)庫中的代碼,然后顯示該用戶的 geoip 位置.現(xiàn)在假設(shè)用戶將他的位置更改為其他地方.如果用戶現(xiàn)在從該地區(qū)或國家登錄,如何我應(yīng)該顯示該用戶的 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.
這篇關(guān)于如何在 Nodejs 中查找所有用戶的 geoip 位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!