[英]How to Redirect to another aspx page from javascript function at browser close event?
Is it possible to redirect to another aspx page from javascript function at browser close event ? 是否有可能在浏览器关闭事件时从javascript函数重定向到另一个aspx页面?
Below is the code i followed but its not working.. 下面是我遵循的代码,但无法正常工作。
if (!e) var e = window.event;
{
if (e) {
alert("hi Chrome one");
//document.location.href = "http://www.google.com";
//window.location = "http://www.google.com";
//window.location.href = "http://www.google.com";
}
}
Can anyone give me the solution. 谁能给我解决方案。
Thanks in advance. 提前致谢。
Yes - you can use the body.unload event to do whatever you want - here's an example for opening a new window. 是的-您可以使用body.unload事件执行所需的操作- 这是打开新窗口的示例 。
UPDATE: try this: 更新:试试这个:
<body onbeforeunload="document.location='http://www.google.com'">
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.