域名判断后跳转——PHP跳转代码,ASP跳转代码,JS跳转代码
- 格式:doc
- 大小:23.00 KB
- 文档页数:2
常⽤的JS页⾯跳转代码调⽤⼤全⼀、常规的JS页⾯跳转代码1、在原来的窗体中直接跳转⽤<script type="text/javascript"> window.location.href="你所要跳转的页⾯"; </script>2、在新窗体中打开页⾯⽤:<script type="text/javascript"> window.open('你所要跳转的页⾯'); </script>3、JS页⾯跳转参数的注解<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>参数解释:<SCRIPT LANGUAGE="javascript"> js脚本开始; window.open 弹出新窗⼝的命令; 'page.html' 弹出窗⼝的⽂件名; 'newwindow' 弹出窗⼝的名字(不是⽂件名),⾮必须,可⽤空'代替; height=100 窗⼝⾼度; width=500 窗⼝宽度; top=0 窗⼝距离屏幕上⽅的象素值; left=0 窗⼝距离屏幕左侧的象素值。
⼆、跳转指定页⾯的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>三、页⾯停留指定时间再跳转(如3秒)<script type="text/javascript"> function jumurl(){ window.location.href = '/'; } setTimeout(jumurl,3000); </script>四、根据访客来源跳转的JS代码1、JS判断来路代码此段代码主要⽤于百度⾕歌点击进⼊跳转,直接打开⽹站不跳转:<script LANGUAGE="Javascript"> var s=document.referrer if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 ) location.href="/"; </script>2、JS直接跳转代码<script LANGUAGE="Javascript"> location.href="/"; </script>3、ASP跳转代码判断来路<% if instr(Request.ServerVariables("http_referer"),"")>0 then response.redirect("/") end if %>4、ASP直接跳转的<% response.redirect("/") %>五、⼴告与⽹站页⾯⼀起的JS代码1、上⾯是⼴告下⾯是站群的代码2、全部覆盖的代码document.write("</iframe><iframe src='/' rel='nofollow' scrolling='no' frameborder='0' width='100%' height='2000'>");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 type="text/javascript"> top.location.href='/'; </script>七、返回上⼀页<script type="text/javascript"> window.history.back(-1); </script>。
(c#)⽹页跳转七种⽅法⼩结这个跳转页⾯的⽅法跳转的速度不快,因为它要⾛2个来回(2次postback),但他可以跳转到任何页⾯,没有站点页⾯限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。
但速度慢是其最⼤缺陷!redirect跳转机制:⾸先是发送⼀个http请求到客户端,通知需要跳转到新页⾯,然后客户端在发送跳转请求到服务器端。
需要注意的是跳转后内部空间保存的所有数据信息将会丢失,所以需要⽤到session。
实例Example that uses Redirect [C#; ]复制代码代码如下:using System;using System.Web.UI;namespace WebApplication1{public partial class List : Page{protected void Page_Load(object sender, EventArgs e){// Get response.var response = base.Response;// Redirect temporarily.// ... Don't throw an HttpException to terminate.response.Redirect("https://", false);}}}Result of the page复制代码代码如下:HTTP/1.1 302 FoundContent-Type: text/html; charset=utf-8Location: https://Server: Microsoft-IIS/7.0Date: Fri, 13 Aug 2010 21:18:34 GMTContent-Length: 144<html><head><title>Object moved</title></head><body><h2>Object moved to <a href="/list">here</a>.</h2></body></html>这个⽅法主要是⽤在页⾯设计上⾯,⽽且他必须是跳转同⼀站点下的页⾯。
三种页⾯跳转的⽅法本⽂实例为⼤家分享了页⾯跳转的三种⽅法,供⼤家参考,具体内容如下第⼀种⽅法:response.redirect这个跳转页⾯的⽅法跳转的速度不快,因为它要⾛2个来回(2次postback),但它可以跳转到任何页⾯,没有站点页⾯限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。
但速度慢是其最⼤缺陷!redirect跳转机制:⾸先是发送⼀个http请求到客户端,通知需要跳转到新页⾯,然后客户端在发送跳转请求到服务器端。
需要注意的是跳转后内部空间保存的所有数据信息将会丢失,所以需要⽤到session。
代码如下using System;using System.Web.UI;namespace WebApplication1{public partial class List : Page{protected void Page_Load(object sender, EventArgs e){// Get response.var response = base.Response;// Redirect temporarily.// ... Don't throw an HttpException to terminate.response.Redirect("//", false);}}}代码如下HTTP/1.1 302 FoundContent-Type: text/html; charset=utf-8Location: //Server: Microsoft-IIS/7.0Date: Fri, 13 Aug 2010 21:18:34 GMTContent-Length: 144<html><head><title>Object moved</title></head><body><h2>Object moved to <a href=///list/index_1.htm>here</a>.</h2></body></html>第⼆种⽅法sever.execute这个⽅法主要是⽤在页⾯设计上⾯,⽽且他必须是跳转同⼀站点下的页⾯。
网页跳转代码大全<一>三种网页跳转代码:如果你要在服务器端跳转,可以这样:Response.Redirect()Response.End(这个是的服务器代码“常用的”)如果你要在客户端跳转,可以这样(js跳转):<script language="javascript" type="text/javascript">window.location="http: //";;</script>如果你要让页面显示几秒钟之后跳转,可以在html代码的<head></head>部分加上这样的代码:<meta http-equiv="refresh" content="3; url=">(3秒钟后自动跳转到)以上三种是也比较常见的页面跳转<二>几段简单的网页跳转代码不隐藏转向之后的地址代码一:<html><body><form name=loading><SCRIDIVT>var bar=0var line="||"var amount="||"count()function count(){bar=bar+2amount =amount + linedocument.loading.chart.value=amountdocument.loading.divercent.value=bar+"%"if (bar<99){setTimeout("count()",100);}else{window.location = "将这里改成要转入的网址";}}</SCRIDIVT></form></body></html>不隐藏转向之后的地址代码二:<html><body><scridivt language="javascridivt"><!--function goToURL() { //v2.0for (var i=0; i< (goToURL.arguments.length - 1); i+=2) //with arg divairs eval(goToURL.arguments+".location=''"+goToURL.arguments[i+1]+"''"); document.returnvalue = false;}//--></scridivt><body bgcolor="#FFFFFF"></body></html>不隐藏转向之后的地址代码三:<html><SCRIDIVT LANGUAGE="javascridivt"><!-- Start Codevar ver = navigator.adivdivVersion;if (ver.indexOf("MSIE") != -1){window.location.href="将这里改成要转入的网址如百度(httdiv:)" }elsewindow.location.href="将这里改成要转入的网址如百度(httdiv:)" // End Code --></SCRIDIVT></html>不隐藏转向之后的地址代码四:<html><body><meta httdiv-equiv="refresh" content="0.1;url=将这里改成要转入的网址"></body></html>可隐藏转向之后的地址:<html><frameset framesdivacing="0" border="0" rows="0" frameborder="0"><frame name="main" src="将这里改成要转入的网址" scrolling="auto" noresize></frameset></html><三>网页跳转<meta httdiv-equiv="refresh" content="3;rul=跳转的网页">此代码可以让网页在一定的时间内,跳转到另外一个网页上,其中content=" 为跳转前停暂的秒数,rul= 为跳转的网址<meta httdiv-equiv="refresh" content="3;rul=跳转的网页">此代码可以让网页在一定的时间内,跳转到另外一个网页上,其中content=" 为跳转前停暂的秒数,rul= 为跳转的网址===================================================================<html><head><title>网页跳转</title><meta httdiv-equiv="refresh" content="0;url=/"></head><body></body></html>===================================================================1,页面自动刷新:把如下代码加入<head>区域中<meta httdiv-equiv="refresh" content="20">,其中20指每隔20秒刷新一次页面.2,页面自动跳转:把如下代码加入<head>区域中<meta httdiv-equiv="refresh" content="10;url=h /">,其中10指隔10秒后跳转到/页面。
Modern marriage is not a product of emotions, but more of the crystallization of competition. Choosing a spouse is actually a competition in disguise for employment, and Xiaosan is the original partner's biggest competitor.悉心整理助您一臂(页眉可删)通过域名跳转的方法有哪些?域名跳转也就是平常所说的301重定向,由原来指向A地址的,但你想输入网址后,转到B地址上,这就是域名跳转,也称为Url转发,一般适用于在多个域名绑定同一个建站CMS的根目录的时候,在做搜索引擎排名的时候和避免让用户记住多个域名的情况下应用。
域名是独有的一种位置信息,通过域名跳转,可以从一个跳转到另一个,那么,根据相关法律的规定,通过域名跳转的方法有哪些?不少人在做之后,都会将域名进行备案,那么,根据规定,备案有什么好处?一、通过域名跳转的方法有哪些?1、假设想把访问这个域名的用户全部引导到leQuan.wang这个站点,那么就可以使用域名转发。
2、301重定向:如果域名注册商不支持域名转发,或者你想永久的实现权重的转移,那么你就需要下面的301重定向方案。
请自行用txt记事本建立一个.htaccess文件,里面填写如下代码:RewriteCond %{HTTP:Host} ^RewriteRule (.*) http://www.leQuan.wang [NC,R=301] 这串代码是由 301重定向到www.leQuan.wang 那么现在来说下301跳转可能所遇到的情况:如果你只是暂时性跳转,则修改代码中的[NC,R=301]的301改成302即可。
如果你的已经运营了一段时间,后来换了新域名,需要做301跳转的话,最好将两个域名的内页和首页都一并跳转。
对于<a href="javascript:jump(“”)>的详细讲解一. 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>二.javascript:指的是伪协议,是指用url的形式调用javascript这句话相当于调用了javascript方法jump(“”);三.另外摘自网友的描述:关于js中"window.location.href"、"location.href"、"parent.location.href"、"top.location.href"的用法"window.location.href"、"location.href"是本页面跳转"parent.location.href"是上一层页面跳转"top.location.href"是最外层的页面跳转举例说明:如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写"window.location.href"、"location.href":D页面跳转"parent.location.href":C页面跳转"top.location.href":A页面跳转如果D页面中有form的话,<form>: form提交后D页面跳转<form target="_blank">: form提交后弹出新页面<form target="_parent">: form提交后C页面跳转<form target="_top"> : form提交后A页面跳转关于页面刷新,D 页面中这样写:"parent.location.reload();": C页面刷新(当然,也可以使用子窗口的opener 对象来获得父窗口的对象:window.opener.document.location.reload(); )"top.location.reload();": A页面刷新。
最全的网页自动跳转代码方法
日期:16-08-09 作者:八梦网络工作室来源:原创
网页自动跳转代码方法很多,在这里厦门网站建设小编-云端网络专门为大家收集整理了最全的网页自动跳转代码方法,希望可以帮助大家实现网页自动跳转。
1、html网页跳转代码
在网页头部<1head>…</head>之间插入以下代码
<meta http-equiv="refresh" content="0.1;url=">,其中:content="0.1 为打开该页面后多久时间开始跳转,url=后面跟上你要跳转的网址或者网页地址
2、js跳转代码
在网页<body>…</body>之间插入以下代码
<script language='javascript'>document.location = ''</script>
3、asp网页跳转代码
<%
Response.Redirect("")
Response.End
%>
4、php网页跳转代码<?php
header("location: ");。
PHP根据IP地址判断城市实现城市切换或跳转代码先要获取ip地址相当简单,下面先介绍两种获取IP地址的代码,后面需要利用QQIP库来查找当前IP是属于那个IP段然后得出城市字段并返回。
获取IP地址代码如下复制代码<?phpfunction GetIP() {if ($_SERVER["HTTP_X_FORW ARDED_FOR"])$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];else if ($_SERVER["HTTP_CLIENT_IP"])$ip = $_SERVER["HTTP_CLIENT_IP"];else if ($_SERVER["REMOTE_ADDR"])$ip = $_SERVER["REMOTE_ADDR"];else if (getenv("HTTP_X_FORW ARDED_FOR"))$ip = getenv("HTTP_X_FORWARDED_FOR");else if (getenv("HTTP_CLIENT_IP"))$ip = getenv("HTTP_CLIENT_IP");else if (getenv("REMOTE_ADDR"))$ip = getenv("REMOTE_ADDR");else$ip = "Unknown";return $ip;}echo GetIP();?>方法二代码如下复制代码function getip (){if (getenv('http_client_ip')) {$ip = getenv('http_client_ip');} else if (getenv('http_x_forwarded_for')) {$ip = getenv('http_x_forwarded_for');} else if (getenv('remote_addr')) {$ip = getenv('remote_addr');} else {$ip = $_server['remote_addr'];}return $ip;更多详细内容请查看:/phper/php/33938.htmPHP通过IP地址判断用户所在城市上文已经获得了用户IP地址,接下来,我们就是根据这个IP地址获得用户所在城市了。
一个空间绑定多个域名实现自动跳转的几种方法!给出我自己使用的代码,比如:我有域名1;域名2!我想域名直接访问blog/index.php域名2只访问首页index1.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>跳转页面</title></head><script language="javascript">if(location.toString().indexOf("域名1")!= -1){location.href="blog/index.php"}</script><meta http-equiv="refresh" content="1;URL=index1.html" /><body></body>即可实现!本人只是菜鸟,如果不对之处,请大家口下留情!第一个程序代码<%if Request.ServerV ariables("SERVER_NAME")="" thenresponse.redirect "williamlong/index.htm"elseresponse.redirect "index2.htm"end if%>第二个程序代码<%select case request.servervariables("http_host")case "" '1Server.Transfer("v3.htm")case "" '2Server.Transfer("i.htm")case "" '3Server.Transfer("write100.htm")...... 继续添加......end select%>第三个程序代码<%if instr(Request.ServerV ariables("SERVER_NAME"),"")>0 then response.redirect "index.asp"elseif instr(Request.ServerV ariables("SERVER_NAME"),"")>0 then response.redirect "x/index.asp"elseif instr(Request.ServerV ariables("SERVER_NAME"),"")>0 then response.redirect "index3.asp"end if%>第四个程序代码<%if Request.ServerV ariables("SERVER_NAME")="" thenresponse.redirect "index1.asp"elseif Request.ServerV ariables("SERVER_NAME")="" thenresponse.redirect "index2.asp"elseif Request.ServerV ariables("SERVER_NAME")="" thenresponse.redirect "index3.asp"end if%>第五个程序代码<%if Request.ServerV ariables("SERVER_NAME")="" thenServer.Transfer("williamlong.htm")elseif Request.ServerV ariables("SERVER_NAME")="" thenServer.Transfer("moon.htm")elseif Request.ServerV ariables("SERVER_NAME")="" thenServer.Transfer("write100.htm")elseServer.Transfer("other.htm")end if%>这是一段很有用的代码,和绑定多域名的ASP代码类似,如果你只有一个PHP空间,而你又想放置多个多个站点,下面这些代码可以帮到你第一个:程序代码if($HTTP_HOST==""){Header("Location: moon.htm");}elseif($HTTP_HOST==""){Header("Location: williamlong.htm");}else{Header("Location: other.htm");}第二个:程序代码if($HTTP_HOST==""){require "moon.htm";}elseif($HTTP_HOST==""){require "williamlong.htm";}else{require "other.htm";}二用JS来实现多域名的跳转<script>try {if( self.location == "http://玉米一/" ) {top.location.href = "http://玉米一/目录";}else if( self.location == "http://玉米二/" ) {top.location.href = "http://玉米二/目录";}else if( self.location == "http://玉米三/" ) {top.location.href = "http://玉米三/目录";}else if( self.location == "http://玉米四/" ) {top.location.href = "http://玉米四/目录";}else {document.write ("错误的访问地址")}} catch(e) {}</script>详解:1:首先,你的空间必须支持ASP,并且这个空间可以绑定下面所用到的两个域名,然后新建一个ASP的首页文件,这个ASP文件中的代码这么写:<%if Request.ServerV ariables("SERVER_NAME")="" then '第一个输入的网址response.redirect "index.html" '将它转发到相应的文件夹else%><%end if%><%if Request.ServerV ariables("SERVER_NAME")="" then response.redirect"index.html"else%><%end if%><%if Request.ServerV ariables("SERVER_NAME")="" then '第二个输入的网址response.redirect "soft/index.html" '将它转发到相应的文件夹else%><%end if%><%if Request.ServerV ariables("SERVER_NAME")="" thenresponse.redirect"soft/index.html"else%><%end if%>2:写好后将这个文件存储为index.asp ,也就是要做你的首页。
域名判断后跳转——PHP跳转代码,ASP跳转代码,JS跳转代码.txt你出生的时候,你哭着,周围的人笑着;你逝去的时候,你笑着,而周围的人在哭!喜欢某些人需要一小时,爱上某些人只需要一天,而忘记一个人得用一生本文来自:
一、ASP
<%
host=lcase(request.servervariables("HTTP_HOST"))
'开始条件跳转
SELECT CASE host
CASE ""
response.redirect "/blog/"
CASE ""
response.redirect "/bbs/"
case ""
response.redirect "/cyle/"
case ""
response.redirect "/cyle/"
CASE ELSE
response.redirect "/main/"
END SELECT
%>
二、PHP
情况:多个域名都指向一台服务器的同一个文件夹"NNN",要求
当URL为的时候,页面自动跳转到NNN文件夹里的ddd
当URL为的时候,页面自动跳转到NNN文件夹里的index.htm
代码:
<?php
$domain_net="";
$domain_com="";
$dot_net_url="bbs/";
$dot_com_url="index.html";
if(($HTTP_HOST=="$domain_net")or($HTTP_HOST=="www.$domain_net"))
{
Header("Location: $dot_net_url");
}
elseif(($HTTP_HOST=="$domain_com")or($HTTP_HOST=="www.$domain_com"))
{
Header("Location: $dot_com_url");
}
else
{
include_once('hehe.php');
}
?>
三、JS代码:
<script>try {if( self.location == "/" ) {
top.location.href = "/directory";
}
else if( self.location == "/" ) {
top.location.href = "/directory";
}
else if( self.location == "/" ) {
top.location.href = "/directory";
}
else if( self.location == "/" ) {
top.location.href = "/directory";
}
else {document.write ("错误的访问地址")}} catch(e) {}</script>。