网址导航网站常用的记录访客浏览过的页面效果,通过记录cookie实现,即使显示客户所浏览过的网页,实用js特效代码。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>js记录访客最近浏览过的网页_武鸣人</title> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> 刷新一下试试!<br><br>把下面的代码放到要记录“访客最近浏览过的网页”的页面中就可以了。<br><br> <fieldset id="www_wuming_ren" style="border:1px red solid;width:300px;height:400px;line-height:25px;color:blue;"> <legend style="color:red">您最近浏览过的网页</legend> 未找到您最近浏览过的网页 </fieldset> <script type="text/javascript"> //<![CDATA[ if(navigator.cookieEnabled){//判断是否支持Cookie var tag = document.getElementById("www_wuming_ren");//输出结果DIV id var N = 10;//太长标题截取汉字字数 var listCount = 10;//记录和显示最近几条 var myTitle = escape(document.title) + "^";//取标题 var myUrl = escape(location.pathname) + "$";//取地址 var expTime = new Date(new Date().setDate(new Date().getDate() + 500));//设定过期时间为500天 var edp = "|; expires=" + expTime.toGMTString() + "; path=/";//组合Cookie参数 var allCookie = document.cookie;//取出全部Cookie if(allCookie.indexOf("news=") != -1 || allCookie.indexOf("$|") != -1){//判断是否为第一次浏览 var myCookieStart = allCookie.indexOf("news=") + "news=".length; var myCookieEnd = allCookie.indexOf("$|",myCookieStart); var myCookieall = unescape(allCookie.substring(myCookieStart,myCookieEnd)); var myCookie = myCookieall.split("$"); var myCookieTit = new Array(); var myCookieUrl = new Array(); for(var i = 0; i < myCookie.length; i++){ var myCookieOne = myCookie[i].split("^"); myCookieTit[i] = myCookieOne[0]; myCookieUrl[i] = myCookieOne[1]; } var tagDat = ""; for(var i =myCookieTit.length - 1; i >= 0; i--){//从先到后顺序取得结果值 var textCount = myCookieTit[i].replace(/[^\x00-\xff]/g,"aa").length; if(textCount <= N*2){ texts = myCookieTit[i]; }else{ for(var a = N; a < textCount; a++){ texts = myCookieTit[i].substr(0,a); if(texts.replace(/[^\x00-\xff]/g,"aa").length >= N*2){ texts += "..." break; } } } tagDat += "<a href=\"" + myCookieUrl[i] + "\"" + " title=\"" + myCookieTit[i] + "\">" + texts + "</a><br>" } tag.innerHTML =tagDat;//输出结果给页面div var newCookie = ""; if(myCookie.length < listCount){ for(i in myCookie){ if(myCookieTit[i] == document.title) continue;//去除重复 newCookie += escape(myCookieTit[i]) + "^" + escape(myCookieUrl[i]) + "$" ; } }else{ for(var i = 1; i < listCount; i++){ if(myCookieTit[i] == document.title) continue; newCookie += escape(myCookieTit[i]) + "^" + escape(myCookieUrl[i]) + "$" ; } } document.cookie = "news=" + newCookie + myTitle + myUrl + edp; }else{ document.cookie = "news="+ myTitle + myUrl + edp; } }else{//不支持Cookie的处理 tag.innerHTML="您的浏览器关闭了Cookie功能,不能为您自动保存最近浏览过的网页!" }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) //]]> </script> </body> </html>
本文来自武鸣人网站,转载请注明出处