欢迎光临
我们一直在努力

HTTP_REFERER的工作方式-ASP教程,ASP技巧

建站超值云服务器,限时71元/月

下列情况是从浏览器的地址栏正常取得request.servervariables(“http_referer”)的:
1.直接用<a href>
2.用submit或<input type=image>提交的表单(post or get)
3.使用jscript提交的表单(post or get)

下面我们再看看request.servervariables(“http_referer”)不能正常取值的情况:
1.从收藏夹链接
2.单击主页或者自定义的地址
3.利用jscript的location.href or location.replace()
4.在浏览器直接输入地址
5.<%response.redirect%>
6.<%response.addheader%>或<meta http-equiv=refresh>转向
7.用xml加载地址

显然,request.servervariables(“http_referer”)在多数情况下是不能正常工作的,下面我们看一个例子:
ref.asp
<%
response.write “you came from: ” & request.servervariables(“http_referer”)
%>

ref.htm
<%
response.addheader “refresh”, “10;url=ref.asp”
%> 

<meta http-equiv=refresh content=10;url=ref.asp> 

<form method=get action=ref.asp name=getform> 
<input type=submit value= go there (get) >> > 
<input type=image style=cursor:hand> 
</form><p> 
看看上面的代码会得到什么的结果.
<form method=post action=ref.asp name=postform> 
<input type=submit value= go there (post) >> > 
<input type=image style=cursor:hand> 
</form><p> 

<a href=ref.asp>直接链接<p> 

<a href=# onclick=window.location.href=”ref.asp”;return false;>javascript location</a> 

<a href=#onclick=window.location.replace(“ref.asp”);return false;>javascript replace</a> 

<a href=# onclick=document.getform.submit();return false;>javascript get</a> 

<a href=# onclick=document.postform.submit();return false;>javascript post </a>

转自:动态网制作指南 www.knowsky.com
赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » HTTP_REFERER的工作方式-ASP教程,ASP技巧
分享到: 更多 (0)