现在的位置: 首页 > 综合 > 正文

[HTML]如何取得上一页的URL(进入本页前的URL )

2013年08月14日 ⁄ 综合 ⁄ 共 824字 ⁄ 字号 评论关闭

 如何取得上一页的URL(进入本页前的URL )


1.Javascript的方式: document.referrer

2.asp/asp.net的方式:request.servervariables("HTTP_REFERER")

3.asp/asp.net的方式(手机):我是用Request.ServerVariables("HTTP_REFERER")这一句
   在WEB上是可以得到的,但是在手机浏览的页面,得到的就为空.以下方式可以实现。

<%
Function GetUrl()
  On Error Resume Next
  Dim strTemp
 If LCase(Request.ServerVariables(
"HTTPS")) = "off" Then
  strTemp 
= "http://"
 Else
  strTemp 
= "https://"
        End If
  strTemp 
= strTemp & Request.ServerVariables("SERVER_NAME")
  If Request.ServerVariables(
"SERVER_PORT"<> 80 Then 
      strTemp 
= strTemp & ":" & Request.ServerVariables("SERVER_PORT")
  end 
if
  strTemp 
= strTemp & Request.ServerVariables("URL")
  If Trim(Request.QueryString) 
<> "" Then 
      strTemp 
= strTemp & "?" & Trim(Request.QueryString)
  end 
if
  GetUrl 
= strTemp
End Function


response.write 
"来访地址:" & geturl()
response.end()
%>

 

 

抱歉!评论已关闭.