/* var sysurl = 'swt.kawaedu.com'; var siteid = ''; var ldpage = window.location.href; var qz = ''; if(ldpage.indexOf('https://') == 0){ qz = 'https://'; }else{ qz = 'http://'; } alert(ldpage); var sid = getCookie('kawaeduvisitsid'); var cid = getCookie('kawaeduvisitcid'); var message = new Object(); message.comeurl = encodeURIComponent(document.referrer); message.loadingpage = encodeURIComponent(window.location.href); message = JSON.stringify(message); var socket = io('https://swt.kawaedu.com:2345'); socket.on('connect', function(){ console.log('connect ok !'); }); socket.on('tishi', function(msg){ console.log(msg); }); var sh; sh = setInterval(xintiao,1000); //检测访客心跳,保持访客的链接 function xintiao(){ socket.emit('xintiao','xintiao_data'); } function setCookie(name,value,exp,path){ var expDays = exp*24*60*60*1000; //1天有效 var expDate = new Date(); expDate.setTime(expDate.getTime()+expDays); var expString = ((exp == null) ? "" : (";expires="+expDate.toGMTString())); var pathString = ((path == null) ? "/" : (";path="+path)); return document.cookie = name + "=" + escape(value) + expString + pathString; } function getCookie(name){ var result = null; var myCookie = document.cookie + ";"; var searchName = name + "="; var startOfCookie = myCookie.indexOf(searchName); var endOfCookie; if (startOfCookie != -1){ startOfCookie += searchName.length; endOfCookie = myCookie.indexOf(";",startOfCookie); result = unescape(myCookie.substring(startOfCookie, endOfCookie)); } return result; } */