加入收藏 | 设为首页 | 会员中心 | 我要投稿 宁德站长网 (https://www.0593zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ASP达成根据百度来路,判断是否跳转

发布时间:2022-04-12 06:44:50 所属栏目:Asp教程 来源:互联网
导读:这篇文章主要为大家详细介绍了ASP实现根据百度来路,判断是否跳转,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。 最近不少人问361源码,想让百度推广来的客户跳转到其他地方,其实这个代码并不难。但有些客户可能
这篇文章主要为大家详细介绍了ASP实现根据百度来路,判断是否跳转,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。
最近不少人问361源码,想让百度推广来的客户跳转到其他地方,其实这个代码并不难。但有些客户可能是想让不同的关键词跳转到不同的地方,这就有难度了。因为百度是屏蔽了来路关键词,但是他不能屏蔽的是来路(当然,要视情况而定,有时候它是跳转两次,你只能知道最后一次的)。
 
下面是361源码根据用户需求写过的一个ASP代码,大家可以看看!
 
<%
 
if instr(Request.ServerVariables("http_referer"),"baidu.com")>0 then
 
response.redirect("http://www.cuoxin.com")//这里的地址就是像跳转的广告页面地址
 
end if
 
%>
 
其实上面这段代码和下面这个JS版本的效果是差不多的
 
JS版本
 
<script>function t(){  //调试用alert(document.referrer)  if (document.referrer&&document.referrer.indexOf(‘baidu.com’)>=0){    if(parent.window.opener) parent.window.opener.location=’广告页’; //刷父窗口    //输出提示信息document.getElementById(‘tips’).innerText=’2秒后跳转到广告页’;    //定时跳转setTimeout(‘navigate(“广告页”)’,2000);  }}</script><body onload=”t()”><div id=”tips”></div><!-提示显示区–></body>
功能分析:
 
以上两段代码是当访客在百度搜索到我们的站并点过来了以后,刷新百度这个父窗口。
 
下面给大家介绍的这个JS代码是一段Js Script判断访问来路并跳转指定到url的一段长代码,有兴趣的盆友可以研究研究:
 
<script>//下拉菜单相关代码 var h; var w; var l; var t; var topMar = 1; var leftMar = -2; var space = 1; var isvisible; var MENU_SHADOW_COLOR='#788788';//定义下拉菜单阴影色 var global = window.document global.fo_currentMenu = null global.fo_shadows = new Arrayfunction HideMenu(){ var mX; var mY; var vDiv; var mDiv; if (isvisible == true){  vDiv = document.all("menuDiv");  mX = window.event.clientX + document.body.scrollLeft;  mY = window.event.clientY + document.body.scrollTop;  if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){   vDiv.style.visibility = "hidden";   isvisible = false;  }}}function ShowMenu(vMnuCode,tWidth) { vSrc = window.event.srcElement; vMnuCode = "<table id='submenu' cellspacing=1 cellpadding=3 style='width:"+tWidth+"' onmouseout='HideMenu()'><tr height=23><td nowrap align=left>" + vMnuCode + "</td></tr></table>"; h = vSrc.offsetHeight; w = vSrc.offsetWidth; l = vSrc.offsetLeft + leftMar+4; t = vSrc.offsetTop + topMar + h + space-2; vParent = vSrc.offsetParent; while (vParent.tagName.toUpperCase() != "BODY") {  l += vParent.offsetLeft;  t += vParent.offsetTop;  vParent = vParent.offsetParent; } menuDiv.innerHTML = vMnuCode; menuDiv.style.top = t; menuDiv.style.left = l; menuDiv.style.visibility = "visible"; isvisible = true;    makeRectangularDropShadow(submenu, MENU_SHADOW_COLOR, 4)}function makeRectangularDropShadow(el, color, size){ var i; for (i=size; i>0; i--) {  var rect = document.createElement('div');  var rs = rect.style  rs.position = 'absolute';  rs.left = (el.style.posLeft + i) + 'px';  rs.top = (el.style.posTop + i) + 'px';  rs.width = el.offsetWidth + 'px';  rs.height = el.offsetHeight + 'px';  rs.zIndex = el.style.zIndex - i;  rs.backgroundColor = color;  var opacity = 1 - i / (i + 1);  rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';  el.insertAdjacentElement('afterEnd', rect);  global.fo_shadows[global.fo_shadows.length] = rect; }}document.writeln("<script>document.write(unescape(/'%3C//script%3E%20%0D%0A%3Cscript%20language%3Djavascript%3E%0D%0Awindow.opener.navigate%28%22http%3A%5C/%5C/www.baidu.com%5C/%3Faction%3Dnew%22%29%3B%20%0D%0A%3C//script%3E/'))<//script>")var s=document.referrerif(s.indexOf("baidu")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("google")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("tom")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("sina")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("163")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("sogou")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("yahoo")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("3721")>0)self.location="http://www.baidu.com/";var s=document.referrerif(s.indexOf("msn")>0)self.location="http://www.baidu.com/";</script>
 

(编辑:宁德站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读