onbeforeunload being called multiple times

Discussion in 'Javascript' started by saugust@cma.com, Aug 16, 2006.

  1. Guest

    Hey:

    I am using the onbeforeunload as a way to indicate to the user that
    they have made some changes and to give them a way to stay on the page
    to complete their intended function.

    This is a very simple process that is well documented throughout the
    web. However, I have come across a problem that results in this event
    being fired multiple times. In my particular situation, my application
    has a tabbed UI where if a tab is clicked, a "redirect" function within
    JavaScript is called. The window.document is "replaced" with html that
    submits itself. The purpose is to take a particular URL and parse it's
    query string and make hidden input buttons that will be available
    within the Request object after the submit while keeping the same page.

    This is where the problem occurs as the onbeforeunload is fired when
    the window.document.open method is executed and all of the "write"
    methods for that window.document. If I try to attach/deattach or use
    variables to only allow one onbeforeunload event to be fired, the page
    still navigates away.

    Any ideas?
    , Aug 16, 2006
    #1
    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. GfxGuy
    Replies:
    0
    Views:
    884
    GfxGuy
    May 4, 2005
  2. djskrill
    Replies:
    9
    Views:
    683
    djskrill
    Oct 1, 2003
  3. Apricot
    Replies:
    4
    Views:
    504
    velthuijsen
    Apr 16, 2004
  4. Radu
    Replies:
    7
    Views:
    688
    charlie_Stell
    Aug 28, 2009
  5. Felix
    Replies:
    1
    Views:
    325
    Felix
    Sep 29, 2006
Loading...

Share This Page