关闭浏览器窗口时我需要一条警告消息(点击浏览器的X按钮时) [英] I need an alert message when closing the browser window (when clicked on X button of browser)

查看:92
本文介绍了关闭浏览器窗口时我需要一条警告消息(点击浏览器的X按钮时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

所有......



当我关闭浏览器关闭(X)按钮时,我需要一条警告信息。我在谷歌搜索这个问题,但答案是使用表格的body标签中的onbeforeunload()方法。但是当我使用包含母版页的表单时,没有正文标记来调用此方法。我这个案子应该怎么办?如果有人知道解决方案,请告诉我。不使用表单中的body标签。当我在body标签中使用这个onbeforeunload()时,但当我刷新页面时此警报触发。刷新页面时不会触发此警报消息。



提前感谢...

Dear,
All...

I need an alert message when I close the browser close(X) button. I googling on this issue, but answers are use onbeforeunload() method in body tag of the form. But when am using master page contained forms there is no body tag to call this method. I this case what i should do? please let me know, if anybody knows the solution. without using body tag in the form. when am using this onbeforeunload() in body tag, but when i refresh the page this alert firing. this alert message not fired when refresh the page.

Thanks in advance...

推荐答案

嗯,

http:/ /blkarwasara.blogspot.com/2012/01/detecting-close-button-of-browser-by.html。 [ ^ ]



这是与你不同的方法,但它可以帮助你做你的工作希望在浏览器关闭。

-Milind
Well,
One article at http://blkarwasara.blogspot.com/2012/01/detecting-close-button-of-browser-by.html.[^]

This is different approach then yours but it may help you to do the work you want at browser close.
-Milind


这篇关于关闭浏览器窗口时我需要一条警告消息(点击浏览器的X按钮时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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