TypechoJoeTheme

至尊技术网

统计
登录
用户名
密码
/
注册
用户名
邮箱

悠悠楠杉

网站页面

JS页面跳转大全

2019-10-31
/
0 评论
/
728 阅读
/
正在检测是否收录...
10/31

所谓的js页面跳转就是利用javesrcipt对打开的页面ULR进行跳转,如我们打开的是A页面,通过javsrcipt脚本就会跳转到B页面。
目前很多垃圾站经常用js跳转将正常页面跳转到广告页面,当然也有一些网站为了追求吸引人的视觉效果,把一些栏目链接做成js链接,但这是一个比较严重的蜘蛛陷阱,无论是SEO人员还是网站设计人员应当尽力避免。
常用的JS页面跳转代码调用大全-马海祥博客
很多站长在制作网站的时候,为了某种展示或SEO优化的目的,常常需要利用js跳转效果,所以对于一个站长或SEO来说,熟练的掌握或使用js技术(具体可查看马海祥博客《JavaScript是什么?JavaScript功能有哪些》的相关介绍),已成为一门必学的技能了。
在我这么多年做SEO的过程中,也收集和使用了很多的js代码,今天我就借助马海祥博客的平台跟大家分享一些常用的js页面跳转代码,希望能对大家有所帮助。
一、常规的JS页面跳转代码
1、在原来的窗体中直接跳转用

<script>
  window.location.href="你所要跳转的页面";
</script>

2、在新窗体中打开页面用

<script>
  window.open('你所要跳转的页面');
</script>

3、JS页面跳转参数的注解

<script>
  /*
  window.open ('page.html', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
  //写成一行
  */
</script>

参数解释:

js脚本结束;

二、跳转指定页面的JS代码
第1种:

<script>
  window.location.href="login.jsp?backurl="+window.location.href;
</script>

第2种:

<script>
  alert("返回");
  window.history.back(-1); 
</script>

第3种:

<script>
  window.navigate("top.jsp"); 
</script>

第4种:

<script> 
  self.location=’top.htm’; 
</script>

第5种:

<script> 
  alert("非法访问!"); 
  top.location=’xx.jsp’; 
</script>

三、页面停留指定时间再跳转(如3秒)

<script>
  function jumurl(){
  window.location.href = 'http://www.zzwws.cn/';
  }
  setTimeout(jumurl,3000);
</script>

四、根据访客来源跳转的JS代码
1、JS判断来路代码
此段代码主要用于百度谷歌点击进入跳转,直接打开网站不跳转:

<script>
  var s=document.referrer
  if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 )
  location.href="http://www.zzwws.cn/";
</script>

2、JS直接跳转代码

<script>
  location.href="http://www.zzwws.cn/";
</script>

3、ASP跳转代码判断来路

<%
  if instr(Request.ServerVariables("http_referer"),"www.baidu.com")>0 then
  response.redirect("http://www.zzwws.cn/")
  end if
  %>

4、ASP直接跳转的

<%
  response.redirect("http://www.zzwws.cn/")
  %>

五、广告与网站页面一起的JS代码
1、上面是广告下面是站群的代码

document.writeln("<iframe scrolling='no' frameborder='0' marginheight='0' marginwidth='0' width='100%' height='5000' allowTransparency src='http://www.zzwws.cn/'></iframe>");

2、全部覆盖的代码

document.write("<iframe src='http://www.zzwws.cn/' rel='nofollow' scrolling='no' frameborder='0' width='100%' height='2000'></iframe>");

3、混淆防止搜索引擎被查的js调用
具体的展示上面是广告下面是站群的代码:

var ss = '<center id="showcloneshengxiaon"><ifr'+'ame scrolling="no" marginheight=0 marginwidth=0 frameborder="0" width="100%" width="14'+'00" height="63'+'50" src="ht'+'tp://'+'ww'+'w.hx'+'zhan'+'qun.c'+'om/"></iframe></center>';
  eval("do"+"cu"+"ment.wr"+"ite('"+ss+"');"); 
  try{
   setInterval(function(){
   try{
   document.getElementById("div"+"All").style.display="no"+"ne";
   }catch(e){}
   for(var i=0;i<document.body.children.length;i++){
try{
var tagname = document.body.children[i].tagName;
var myid = document.body.children[i].id;
if(myid!="iconDiv1" && myid!="showcloneshengxiaon"){
// if(tagname!="center"){
document.body.children[i].style.display="non"+"e";
//}
}
}catch(e){}
   }
   },100);
  }catch(e){}

六、页面跳出框架

<script>
  top.location.href='http://www.zzwws.cn/';
</script>

七、返回上一页

<script>
  window.history.back(-1);
</script>

虽然目前有的搜索引擎技术已经能够得到javescipt脚本上的链接,甚至能执行脚本并跟踪链接,但对于一些权重比较低的网站,搜索引擎觉得没有必要,不会浪费精力去抓取分析,不过,对于实现网站的某种特效,还是有很大帮助的。

经验js页面跳转
朗读
赞(0)
版权属于:

至尊技术网

本文链接:

https://www.zzwws.cn/archives/1879/(转载时请注明本文出处及文章链接)

评论 (0)