第二次尝试刷新时如何将页面重定向到另一个页面 [英] How to redirect a page to another page when refresh at second attempt

查看:118
本文介绍了第二次尝试刷新时如何将页面重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script language="JavaScript">
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
   alert("");window.location="index.html";
  }
</script>

我在这里尝试但不工作,请指导我

Here i tried but not working please guide me

推荐答案

bbb.jsp中:

window.onbeforeunload = function() { 
    window.setTimeout(function () { 
        window.location = 'AAA.jsp';
    }, 0); 
    window.onbeforeunload = null; // necessary to prevent infinite loop, that kills your browser 
}

这篇关于第二次尝试刷新时如何将页面重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆