我正在尝试获取客户端系统详细信息,我尝试获取数据 IP 地址、国家/地区、州、位置等。但是,我仍然需要更多信息,例如...客户端系统名称、客户端操作系统和客户端时间戳。如何使用 Javascript 获取所有这些信息。
代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Get User Details IP Address, city, country, state, latitude, longitude </title>
<script src="http://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script>
<script type="text/javascript">
var strip, strcountry, strcity, strregion, strlatitude, strlongitude, strtimezone
function GetUserInfo(data) {
alert(data.hostname);
strip = data.host;
strcountry = data.countryName;
strcity = data.city;
strregion = data.region;
strlatitude = data.latitude;
strlongitude = data.longitude;
strtimezone = data.timezone;
}
$(function() {
BindUserInfo();
})
function BindUserInfo() {
document.getElementById('lblIP').value = strip;
document.getElementById('lblCountry').value = strcountry;
document.getElementById('lblCity').value = strcity;
document.getElementById('lblregion').value = strregion;
document.getElementById('lbllatitude').value = strlatitude;
document.getElementById('lbllongitude').value = strlongitude;
document.getElementById('lbltimezone').value = strtimezone;
}
</script>
<script type="text/javascript" src="http://smart-ip.net/geoip-json?callback=GetUserInfo"></script>
</head>
<body>
<div>
<table>
<tr>
<td>
<input type="text" id="lblIP" value="" />
<input type="text" id="lblCountry" value="" />
<input type="text" id="lblCity" value="" />
<input type="text" id="lblregion" value="" />
<input type="text" id="lbllatitude" value="" />
<input type="text" id="lbllongitude" value="" />
<input type="text" id="lbltimezone" value="" />
</td>
</tr>
</table>
</div>
</body>
</html>