Body OnUnload ASP.NET Postback question

Discussion in 'ASP .Net' started by Bishop, Jul 17, 2009.

  1. Bishop

    Bishop Guest

    I want to display an exit web page when someone closes a web page from they're
    browser. Looks like I can do this with JavaScript and the Body OnUnload tag
    but it kicks off with a post back. Any tricks to preventing this from
    kicking off on post back and only when closing the browser?
    Bishop, Jul 17, 2009
    #1
    1. Advertising

  2. "Bishop" <> wrote in
    news::

    > I want to display an exit web page when someone closes a web page from
    > they're browser. Looks like I can do this with JavaScript and the
    > Body OnUnload tag but it kicks off with a post back. Any tricks to
    > preventing this from kicking off on post back and only when closing
    > the browser?



    You can check whether or not a user is closing the browser down:
    http://www.coderanch.com/t/112054/HTML-JavaScript/check-if-browser-close-
    button

    You can also check if a user is leaving your site, hitting the back button,
    etc. I don't have links for these.

    You then code these checks and only if they are true do you show the exit
    page.

    NOTE: If this is not an Intranet, you are going to piss a lot of people off
    if you stop the browser from shutting down until they read your page.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
    Gregory A. Beamer, Jul 17, 2009
    #2
    1. Advertising

  3. "Mark Rae [MVP]" <> wrote in
    news:u4xKD$:


    > That's the salient point here. In my experience, people will never
    > return to a site which does this to them...


    Preacher >> Choir LOL

    I am waiting for the "I want to make dozens of pop ups when someone tries
    to leave my site conversation. ;-0


    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
    Gregory A. Beamer, Jul 20, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oleg Ogurok

    add <body onunload="blah();">

    Oleg Ogurok, Dec 29, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,522
    Carl Prothman [MVP]
    Dec 29, 2003
  2. =B=
    Replies:
    3
    Views:
    3,848
  3. Laurent Bugnion
    Replies:
    1
    Views:
    10,041
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 21, 2006
  4. ~~~ .NET Ed ~~~
    Replies:
    5
    Views:
    1,355
    David Wainwright
    Mar 27, 2007
  5. Brian Vallelunga

    onunload without body tag reference?

    Brian Vallelunga, Jul 28, 2003, in forum: Javascript
    Replies:
    2
    Views:
    120
    Brian Vallelunga
    Jul 28, 2003
Loading...

Share This Page