目前很多垃圾站經(jīng)常用js跳轉(zhuǎn)將正常頁面跳轉(zhuǎn)到廣告頁面,當(dāng)然也有一些網(wǎng)站為了追求吸引人的視覺" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)絡(luò)營銷 > 常用的JS頁面跳轉(zhuǎn)代碼調(diào)用大全

常用的JS頁面跳轉(zhuǎn)代碼調(diào)用大全

時間:2022-05-29 14:42:01 | 來源:網(wǎng)絡(luò)營銷

時間:2022-05-29 14:42:01 來源:網(wǎng)絡(luò)營銷

所謂的js頁面跳轉(zhuǎn)就是利用javesrcipt對打開的頁面ULR進行跳轉(zhuǎn),如我們打開的是A頁面,通過javsrcipt腳本就會跳轉(zhuǎn)到B頁面。

目前很多垃圾站經(jīng)常用js跳轉(zhuǎn)將正常頁面跳轉(zhuǎn)到廣告頁面,當(dāng)然也有一些網(wǎng)站為了追求吸引人的視覺效果,把一些欄目鏈接做成js鏈接,但這是一個比較嚴重的蜘蛛陷阱,無論是SEO人員還是網(wǎng)站設(shè)計人員應(yīng)當(dāng)盡力避免。

很多站長在制作網(wǎng)站的時候,為了某種展示或SEO優(yōu)化的目的,常常需要利用js跳轉(zhuǎn)效果,所以對于一個站長或SEO來說,熟練的掌握或使用js技術(shù)(具體可查看億企邦《JavaScript是什么?JavaScript功能有哪些》的相關(guān)介紹),已成為一門必學(xué)的技能了。

在我這么多年做SEO的過程中,也收集和使用了很多的js代碼,今天我就借助億企邦的平臺跟大家分享一些常用的js頁面跳轉(zhuǎn)代碼,希望能對大家有所幫助。

一、常規(guī)的JS頁面跳轉(zhuǎn)代碼

1、在原來的窗體中直接跳轉(zhuǎn)用

<script type="text/javascript">
  window.location.href="你所要跳轉(zhuǎn)的頁面";
  </script>

2、在新窗體中打開頁面用:

<script type="text/javascript">
  window.open('你所要跳轉(zhuǎn)的頁面');
  </script>

3、JS頁面跳轉(zhuǎn)參數(shù)的注解

<SCRIPT LANGUAGE="javascript">
  <!--
  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>

參數(shù)解釋:

<SCRIPT LANGUAGE="javascript"> js腳本開始;
  window.open 彈出新窗口的命令;
  'page.html' 彈出窗口的文件名;
  'newwindow' 彈出窗口的名字(不是文件名),非必須,可用空'代替;
  height=100 窗口高度;
  width=500 窗口寬度;
  top=0 窗口距離屏幕上方的象素值;
  left=0 窗口距離屏幕左側(cè)的象素值。

二、跳轉(zhuǎn)指定頁面的JS代碼

第1種:

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

第2種:

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

第3種:

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

第4種:

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

第5種:

<script language="javascript">
  alert("非法訪問!");
  top.location=’xx.jsp’;
  </script>

三、頁面停留指定時間再跳轉(zhuǎn)(如3秒)

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

四、根據(jù)訪客來源跳轉(zhuǎn)的JS代碼

1、JS判斷來路代碼

此段代碼主要用于百度谷歌點擊進入跳轉(zhuǎn),直接打開網(wǎng)站不跳轉(zhuǎn):

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

2、JS直接跳轉(zhuǎn)代碼

<script LANGUAGE="Javascript">
  location.href="http://www.mahaixiang.cn/";
  </script>

3、ASP跳轉(zhuǎn)代碼判斷來路

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

4、ASP直接跳轉(zhuǎn)的

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

五、廣告與網(wǎng)站頁面一起的JS代碼

1、上面是廣告下面是站群的代碼

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

2、全部覆蓋的代碼

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

3、混淆防止搜索引擎被查的js調(diào)用

具體的展示上面是廣告下面是站群的代碼:

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 type="text/javascript">
  top.location.href='http://www.mahaixiang.cn/';
  </script>

七、返回上一頁

<script type="text/javascript">
  window.history.back(-1);
  </script>

億企邦點評:

雖然目前有的搜索引擎技術(shù)已經(jīng)能夠得到j(luò)avescipt腳本上的鏈接,甚至能執(zhí)行腳本并跟蹤鏈接,但對于一些權(quán)重比較低的網(wǎng)站,搜索引擎覺得沒有必要,不會浪費精力去抓取分析,不過,對于實現(xiàn)網(wǎng)站的某種特效,還是有很大幫助的。

關(guān)鍵詞:調(diào)用

74
73
25
news

版權(quán)所有? 億企邦 1997-2022 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關(guān)閉