asp.net,javascript浏览器关闭evnt捕获 [英] asp.net,javascript browser close evnt capturing

查看:58
本文介绍了asp.net,javascript浏览器关闭evnt捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



如何在IE中捕获浏览器关闭事件和标签关闭事件。





我的要求是这样的。



我们有一个页面,用户在将数据加载到该页面后无法关闭浏览器。



我需要阻止浏览器关闭。请帮助我。









问候,

Shefeek

解决方案

 <   script     language   =  JavaScript   类型  =  text / javascript >  
window.onbeforeunload = confirmExit;
函数confirmExit()
{
return您试图离开此页面。如果您对字段进行了任何更改而未单击保存按钮,则您的更改将会丢失。你确定要退出此页吗?;
}
< / script >


Hi all,

How can i capture browser close event and tab close event in IE.


my requirement is like this.

we have a page and user cannot close the browser after load the data in to that page.

I need to prevent that browser close.Please help me.




Regards,
Shefeek

解决方案

<script language="JavaScript" type="text/javascript">
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save button, your changes will be lost.  Are you sure you want to exit this page?";
  }
</script>


这篇关于asp.net,javascript浏览器关闭evnt捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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