在asp.net收prevent浏览器 [英] Prevent browser from closing in asp.net

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

问题描述

我使用asp.net 2.0使用C#。

I am using asp.net 2.0 with c#.

我想,当用户试图关闭浏览器将显示一个弹出,如果在无[即用户点击他不希望浏览器被关闭]那么prevent浏览器关闭后得到。
请帮忙。
谢谢

i want a pop up to be displayed when user tries to close the browser and if user click on "no" [i.e. he don't want browser to be closed] then it prevent browser to get closed. Please help. Thanks

推荐答案

他们使用的code是

window.onbeforeunload=function() {
  if (somereasonorother) return "You did not save your stuff"
}

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

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