如何获取前一页的URL地址,而前一页有弹出alert提示框?比如:
点击 a.html 中的一个按纽,弹出一个alert提示框,然后进入b.aspx
想问, b.aspx如何取得它前一页的URL值,也就是 a.html我用
Response.Write(Request.ServerVariables["HTTP_REFERER"]);
得到的是空值.
如果把alert去掉,那是没问题的我主要是用在这种环境:
用户要购买产品而未登录,我要提示它"您未登录",转到登录界面,成功以后,自动转到要购买的产品的那个页面,请问取得那一页的URL怎么写?急,谢谢!
点击 a.html 中的一个按纽,弹出一个alert提示框,然后进入b.aspx
想问, b.aspx如何取得它前一页的URL值,也就是 a.html我用
Response.Write(Request.ServerVariables["HTTP_REFERER"]);
得到的是空值.
如果把alert去掉,那是没问题的我主要是用在这种环境:
用户要购买产品而未登录,我要提示它"您未登录",转到登录界面,成功以后,自动转到要购买的产品的那个页面,请问取得那一页的URL怎么写?急,谢谢!
比如百度贴吧
http://passport.baidu.com/?login&tpl=tb&u=http%3A//tieba.baidu.com/f%3Fkz%3D429947689&aid=6其中&u=http%3A//tieba.baidu.com/f%3Fkz%3D429947689&aid=6的部分
也就是有弹出alert提示的那个URL地址..........
想问, b.aspx如何取得它前一页的URL值,也就是 a.html Response.write("<script>alert('OK');window.location.href='b.aspx?url='a.aspx';</script>");
这样然后在B页面获取你试试
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function test()
{
alert("未登陆!");
window.location.href="../test2/login.htm?url="+window.location.href;
}
</script>
</head>
<body>
<input id="Button1" type="button" value="test" onclick="test()" />
</body>
</html>
login.htm 页面<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function ok()
{
str=location.href; //获取本页url地址
arr=str.split("?");
str1 = arr[1];
arr1=str1.split("=");
window.location.href=arr1[1];
}
</script>
</head>
<body >
<input id="Button1" type="button" value="login" onclick="ok()"/>
</body>
</html>
window.location.href='...?url=+'window.location.href;