js获取客户端time,cookie,url,ip,refer,user_agent信息:
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
window.onload=function(){
gettime(); //js获取当前时间
getip(); //js获取客户端ip
geturl(); //js获取客户端当前url
getrefer(); //js获取客户端当前页面的上级页面的url
getuser_agent(); //js获取客户端类型
getcookie() //js获取客户端cookie
loadXMLDoc();
}
function gettime(){
var nowDate = new Date();
return nowDate.toLocaleString();
}
function geturl(){
return window.location.href;
}
function getip(){
return returnCitySN["cip"]+','+returnCitySN["cname"];
}
function getrefer(){
return document.referrer;
}
function getcookie(){
return document.cookie;
}
function getuser_agent(){
return navigator.userAgent;
}
function loadXMLDoc(){
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
//alert(xmlhttp.responseText);
}
} //http://localhost/git_work/log.php //http://localhost:8088/log.php
xmlhttp.open("POST","http://analysis.wml.com:8088/log.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("time="+gettime()+"&ip="+getip()+"&url="+geturl()+"&refer="+getrefer()+"&user_agent="+getuser_agent()+"&cookie="+getcookie());
}
</script>
相关文章
- 高德地图JS API获取经纬度,根据经纬度获取城市
- JS框架_(coolShow.js)图片旋转动画特效
- JS框架_(JQuery.js)高德地图api
- JS框架_(JQbar.js)柱状图动态百分比进度条特效
- JS框架_(Esign.js)仿信用卡电子签名特效
- JS框架_(JQuery.js)图片相册掀开切换效果
- JS框架_(Bootstrap.js)实现简单的轮播图
- JS - 解决引入 js 文件无效的问题
- baguetteBox.js响应式画廊插件(纯JS)
- js 计算过去和未来的时间距离现在多少天?
- A2D JS框架 - DES加密解密 与 Cookie的封装(C#与js互相加密解密)
- js-ECMAScript-5:常用的内置对象,数组,date,math,json,正则
- [Node.js] Mock an API for Local Development in React with Mirage JS
- js获取节点和编辑的方法
- [WASM] Run WebAssembly in Node.js using the node-loader
- [Vue] Dynamic Vue.js Components with the component element
- SAP UI5应用中的component-preload.js在Netweaver上的存储
- Atitit 研发体系 codelib 代码库的建设 目录 1. 概念与组成2 1.1. Java代码2 1.2. Js代码2 1.3. H5 代码 js+css+htm+txt2 1.4.
- html使用vue模板、html引入vue.js-测试demo
- 带你了解Node.js包管理工具:包与NPM
- Node.js: node-redis.js客户端
- JS:crypto-js模块实现数据加密解密
- js数组去重
- js之广告弹出自动关闭
- JS 客户端浏览器操作、BOM、渗透客户端浏览器(windows对象:screen屏幕操作、location浏览器域名、history浏览器历史、Navigator浏览器信息、cookie)
- js数组转json 、json转数组。数组转逗号隔开字符串、字符串转数组
- JS工具方法 3 js客户端与php服务器通信加密之AES