关闭应用程序之前的确认消息 [英] Conformation message before close the application

查看:58
本文介绍了关闭应用程序之前的确认消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我对Asp.net应用有要求,即...如果用户未签名或注销,则如果他尝试关闭浏览器即单击"X"(浏览器右上方),则我需要显示一个诸如您确定要关闭吗?"之类的消息. ...
我使用母版页,我尝试了以下事件:"window.onbeforeunload"在我的母版页中,其工作状况很好,显示了警报(构象)消息.但是,如果我按后退按钮(在浏览器上),那么它的开火(但它不应该关机)也有什么方法可以完全满足我的要求..plz


在此先感谢
Veera

Hi All,
I had requirement in Asp.net appliction ie... if the user d''nt signoff or logoff then if he trys to close the browser ie clicking on ''X'' (top right of browser) then i need to show a conformation messasge like "Are you sure you want to close ?" ...
Iam using Masterpage and i tryed the event : "window.onbeforeunload " in my master page its works fine shows an alert(conformation) message. but if i press back button(on the browser) then also its firing(but it shuold not be) is there any way to full fill my requirement ..plz


Thanks in advance
Veera

推荐答案

这是asp.net应用程序,是vb还是c#编码?

谢谢.
is this asp.net application, a vb or c# coding?

thanks.


它是一个用Vb编码的Asp.Net应用程序...
its an Asp.Net Application with Vb coding...


尝试一下.

try this one.

Dim strscript As String = "<script language=javascript>window.top.close();</script>"
If (Not ClientScript.IsStartupScriptRegistered("clientScript")) Then
ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript)
End If


这篇关于关闭应用程序之前的确认消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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