如何在网页读取用户IP,操作系统版本等数据demo
发布日期:2021-09-03 11:45:52 浏览次数:2 分类:技术文章

本文共 1316 字,大约阅读时间需要 4 分钟。

 我们浏览网页的时候,会不经意间看到,有些地方(如个人的签名档)显示出了个人的IP,操作系统等数据.借助第三方API和请求报头useragent是很容易实现的.
<html>
<head>
<title>Sherry</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://counter.sina.com.cn/ip/" charset="gb2312"></script>
<script>
document.writeln("IP地址:"+ILData[0]+"<br />");           //输出接口数据中的IP地址
document.writeln("地址类型:"+ILData[1]+"<br />");         //输出接口数据中的IP地址的类型
document.writeln("地址类型:"+ILData[2]+"<br />");         //输出接口数据中的IP地址的省市
document.writeln("地址类型:"+ILData[3]+"<br />");         //输出接口数据中的IP地址的
document.writeln("地址类型:"+ILData[4]+"<br />");         //输出接口数据中的IP地址的运营商
//document.write(navigator.userAgent + "<br>");
document.write("您的 版本为:");
if(navigator.userAgent.indexOf("  NT 6.2") > 0){
document.write("Windows 8");
}
else if(navigator.userAgent.indexOf("Windows NT 6.1") > 0){
document.write("Windows 7");
}
else if(navigator.userAgent.indexOf("Windows NT 6.0") > 0){
document.write("Windows Vista");
}
else if(navigator.userAgent.indexOf("Windows NT 5.2") > 0){
document.write("Windows 2003");
}
else if(navigator.userAgent.indexOf("Windows NT 5.1") > 0){
document.write("Windows xp");
}
else if(navigator.userAgent.indexOf("Windows NT 5.0") > 0){
document.write("Windows 2000");
}
</script>
</head>
<body>
</body>
</html>
  显示:

   

最新内容请见作者的GitHub页:http://qaseven.github.io/

  

转载地址:https://blog.csdn.net/weixin_34186950/article/details/90493814 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:360情报中心:国内2.8万家机构被攻陷 江浙粤较严重
下一篇:八百客CRM:销售漏斗为你开启Easy模式

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月02日 02时00分25秒