JS获取来路URL怎么传给ASP

JavaScript013

JS获取来路URL怎么传给ASP,第1张

JS是客户端的,ASP是服务端的,你这样做没什么意义啊,直接在xx.asp里获取来路就可以了:

Request.ServerVariables("HTTP_REFERER")

字符串处理下

strLength = document.referrer.length

strUrl = document.referrer.substring( 7 , strLength )

strUrl = strUrl.substring( 0 , strUrl . indexOf("/") )

document.write( strUrl )

函数说明

str.Length -------------------返回字符串总长度

str.substring( start_Index, stop_Index ) -----------------截取指定区间字符串

str.indexOf( child_str ) -------------------------返回子字符串第一次在str中出现的位置的

用js来获取原跳转地址

获取window 内部的参数

//获取来源url:ref

var ref = '' 

if (document.referrer.length > 0) { 

  ref = document.referrer 

try { 

  if (ref.length == 0 && opener.location.href.length > 0) { 

   ref = opener.location.href 

  } 

} catch (e) {}    

当前页面地址:window.location.href