开发者

detect browser close events in vb.net

I am having a Web Page that looks like:

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile = "~/Master11.master" CodeBehind="test7.aspx.vb" Inherits="MyApp.test7" %>

<%@ MasterType TypeName = "ASP.sample_template_master" %>

<asp:Content ID="Content2" ContentPlaceHolderID="mainContent1" runat="server">
</asp:Content>

When the user closes the browser, I want to display a confirm box if the 开发者_如何学Pythonuser wants to save before exit.

If he says yes, then I wish to save the information in database and close the browser else I just close the browser.

I read msdn forums but all I found was window closing event which I was not able to apply here.

Please help.

Thanks, krum_cho.


Try using the following JavaScript statement.

    window.onbeforeunload = function () {
        if ((window.event.clientX < 0) || (window.event.clientY < 0) || (window.event.clientX < -80)) {
            alert("Child window is closing...");
        }
    }; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜