onunload and a couple of things...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ric Castagna

    onunload and a couple of things...

    I have a form that I'm trying to handle if the viewer "leaves" without
    completing the entire thing.

    The client wants to be advised that someone one "tried" to fill out
    the application. Most likely situation will be the viewer will click
    on another link in the site, or enter a new address into the browser.

    I've got the onunload() raising an alert box, so I think I can get it
    to do the processing that I want it to.

    Here's my problem...I need to know if there's a way to detect the URL
    that was entered into the address bar or clicked via a link. This way
    I can do the processing I need to and then send them to their desired
    destination.

    Help!

    Thanks in advance,
    Ric
  • Greg

    #2
    Re: onunload and a couple of things...

    As far as I know, this isn't an option.

    When a person clicks on a link in a web-browser, this sends a GET
    request to the server that link points to, and the document that is
    returned replaces the current document and is processed. So if I'm on
    your website, and I click on a link to www.slashdot.org The slashdot
    server sees my request, but yourwebsite doesn't know where I went.

    I could be wrong, but I think this is the way it works.

    ;-) you could always pop up a form that asks them where they are
    going... ;-)

    I think you can allow a cancellation of their exit, via an "are you
    sure?" type dialogue, which could cancel their action, while I've
    observed these, I haven't implemented this.

    Hope that is helpful.
    Greg.


    Ric Castagna wrote:[color=blue]
    > I have a form that I'm trying to handle if the viewer "leaves" without
    > completing the entire thing.
    >
    > The client wants to be advised that someone one "tried" to fill out
    > the application. Most likely situation will be the viewer will click
    > on another link in the site, or enter a new address into the browser.
    >
    > I've got the onunload() raising an alert box, so I think I can get it
    > to do the processing that I want it to.
    >
    > Here's my problem...I need to know if there's a way to detect the URL
    > that was entered into the address bar or clicked via a link. This way
    > I can do the processing I need to and then send them to their desired
    > destination.
    >
    > Help!
    >
    > Thanks in advance,
    > Ric[/color]

    Comment

    • Egbert Beuker

      #3
      Re: onunload and a couple of things...

      Maybe you can put a hidden form AND a hidden frame in the page.

      On the onunload event you submit the form to the framehandler page, target
      is the iframe, and the page will then navigate to the URL requested by the
      user!

      <form id="myHiddenFor m" action="formhan dler.asp" target="myHidde nFrame">
      [info to post]
      </form>

      <iframe id="myHiddenFra me" name="myHiddenF rame"></iframe>

      function window_onunload ()
      {
      myHiddenForm.su bmit();
      }

      (never tried this, but i think it might work!)

      "Ric Castagna" <ric_castagna@h otmail.com> wrote in message
      news:4526d542.0 309131323.5898e 867@posting.goo gle.com...[color=blue]
      > I have a form that I'm trying to handle if the viewer "leaves" without
      > completing the entire thing.
      >
      > The client wants to be advised that someone one "tried" to fill out
      > the application. Most likely situation will be the viewer will click
      > on another link in the site, or enter a new address into the browser.
      >
      > I've got the onunload() raising an alert box, so I think I can get it
      > to do the processing that I want it to.
      >
      > Here's my problem...I need to know if there's a way to detect the URL
      > that was entered into the address bar or clicked via a link. This way
      > I can do the processing I need to and then send them to their desired
      > destination.
      >
      > Help!
      >
      > Thanks in advance,
      > Ric[/color]


      Comment

      • Ian Hobson

        #4
        Re: onunload and a couple of things...

        In message <4526d542.03091 31323.5898e867@ posting.google. com>, Ric
        Castagna <ric_castagna@h otmail.com> writes[color=blue]
        >I have a form that I'm trying to handle if the viewer "leaves" without
        >completing the entire thing.
        >
        >The client wants to be advised that someone one "tried" to fill out
        >the application. Most likely situation will be the viewer will click
        >on another link in the site, or enter a new address into the browser.
        >
        >I've got the onunload() raising an alert box, so I think I can get it
        >to do the processing that I want it to.
        >
        >Here's my problem...I need to know if there's a way to detect the URL
        >that was entered into the address bar or clicked via a link. This way
        >I can do the processing I need to and then send them to their desired
        >destination.
        >[/color]
        It is a while since I tested this area, but this is what I found, (from
        memory). I was only using IE and late NS.

        a) The onunload event will not always be called, (close window) so the
        lack of clear up must not permanently capture resources.

        b) If you have another window or panel/layer open, you can get that to
        do the clear up, and leave the original window to go where the user
        wanted it to go.

        Regards

        Ian
        --
        Ian - posting to a Newsgroup. Please remove everything to reply.

        Comment

        Working...