Site Unload?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ross M. Greenberg

    #1

    Site Unload?

    I want to have an onUnload that runs only when the site is left, not when
    the current page is unloaded. Any ideas?

    Thanks!

    Ross


  • Ross M. Greenberg

    #2
    Re: Site Unload?

    Is there no solution?

    "Ross M. Greenberg" <greenber@catsk ill.net> wrote in message
    news:10ru05esn6 stg7e@corp.supe rnews.com...[color=blue]
    > I want to have an onUnload that runs only when the site is left, not when
    > the current page is unloaded. Any ideas?
    >
    > Thanks!
    >
    > Ross
    >
    >[/color]


    Comment

    • rubikzube*

      #3
      Re: Site Unload?

      You will have to know before the unload where the client is going and
      as far as I know there is no built in way of knowing that via the DOM.
      The only way I can think of accomplishing this is to set an "isLeaving"
      flag on every page of your site and default it to true. Whenever you
      navigate to another page in your site you will have to set it to false.
      Then in the unload you can check to see the status of the flag.

      This method will probably turn into pain in the ass to do on every page
      (although you may be able to trap most items with a script to chase
      down onSubmit onClick events) but I can't think of a better way.
      Anyone else?

      Comment

      • Evertjan.

        #4
        Re: Site Unload?

        Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
        [color=blue]
        > I want to have an onUnload that runs only when the site is left, not when
        > the current page is unloaded. Any ideas?
        >[/color]

        "site is left" is not defined,
        [unless you have a button saying "I solemnly declare to leave the site"]

        With serverside ASP scripting you could do something ON THE SERVER when a
        session ends. This is not very reliable and has no effect on clientside.

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        • Ross M. Greenberg

          #5
          Re: Site Unload?

          Sigh. There has to be something for this!
          "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
          news:Xns95BFCB1 69A5DBeejj99@19 4.109.133.29...[color=blue]
          > Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
          >[color=green]
          > > I want to have an onUnload that runs only when the site is left, not[/color][/color]
          when[color=blue][color=green]
          > > the current page is unloaded. Any ideas?
          > >[/color]
          >
          > "site is left" is not defined,
          > [unless you have a button saying "I solemnly declare to leave the site"]
          >
          > With serverside ASP scripting you could do something ON THE SERVER when a
          > session ends. This is not very reliable and has no effect on clientside.
          >
          > --
          > Evertjan.
          > The Netherlands.
          > (Please change the x'es to dots in my emailaddress)[/color]


          Comment

          • Michael Winter

            #6
            Re: Site Unload?

            On Tue, 14 Dec 2004 14:30:41 -0500, Ross M. Greenberg
            <greenber@catsk ill.net> wrote:
            [color=blue]
            > Sigh. There has to be something for this![/color]

            Why? There's no guarantee that the browser will actually execute *any*
            code when the user chooses to close it.

            [snip]

            Mike


            Please don't top-post.

            --
            Michael Winter
            Replace ".invalid" with ".uk" to reply by e-mail.

            Comment

            • Evertjan.

              #7
              Re: Site Unload?

              Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
              [color=blue]
              > Sigh. There has to be something for this![/color]

              [Please do not topost on usenet]

              No, you cannot detect something that is not defined.

              "leaving a site" in the logical sense has no meaning to me.

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • Michael Winter

                #8
                Re: Site Unload?

                On Tue, 14 Dec 2004 19:33:27 GMT, Michael Winter
                <M.Winter@bluey onder.co.invali d> wrote:
                [color=blue]
                > There's no guarantee that the browser will actually execute *any* code
                > when the user chooses to close it.[/color]

                ....or leave your pages.

                What are you trying to achieve, and why?

                Mike

                --
                Michael Winter
                Replace ".invalid" with ".uk" to reply by e-mail.

                Comment

                • Ross M. Greenberg

                  #9
                  Re: Site Unload?

                  For a commercial site, I want to open a survey page when they exit from the
                  site from any page, but not as they transit along the site's many pages.


                  "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
                  news:opsi0kwiy0 x13kvk@atlantis ...[color=blue]
                  > On Tue, 14 Dec 2004 19:33:27 GMT, Michael Winter
                  > <M.Winter@bluey onder.co.invali d> wrote:
                  >[color=green]
                  > > There's no guarantee that the browser will actually execute *any* code
                  > > when the user chooses to close it.[/color]
                  >
                  > ...or leave your pages.
                  >
                  > What are you trying to achieve, and why?
                  >
                  > Mike
                  >
                  > --
                  > Michael Winter
                  > Replace ".invalid" with ".uk" to reply by e-mail.[/color]


                  Comment

                  • Ross M. Greenberg

                    #10
                    Re: Site Unload?


                    "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
                    news:Xns95BFD41 519566eejj99@19 4.109.133.29...[color=blue]
                    > Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
                    >[color=green]
                    > > Sigh. There has to be something for this![/color]
                    >
                    > [Please do not topost on usenet]
                    >
                    > No, you cannot detect something that is not defined.
                    >
                    > "leaving a site" in the logical sense has no meaning to me.[/color]

                    It may not be formally defined, but how about "when the host changes"?



                    Comment

                    • Ross M. Greenberg

                      #11
                      Re: Site Unload?

                      How about defaulting to false, then setting to true with OnLoad, in essense
                      reversing the sense.

                      "rubikzube* " <thegreatzubini @gmail.com> wrote in message
                      news:1103048707 .926441.163140@ z14g2000cwz.goo glegroups.com.. .[color=blue]
                      > You will have to know before the unload where the client is going and
                      > as far as I know there is no built in way of knowing that via the DOM.
                      > The only way I can think of accomplishing this is to set an "isLeaving"
                      > flag on every page of your site and default it to true. Whenever you
                      > navigate to another page in your site you will have to set it to false.
                      > Then in the unload you can check to see the status of the flag.
                      >
                      > This method will probably turn into pain in the ass to do on every page
                      > (although you may be able to trap most items with a script to chase
                      > down onSubmit onClick events) but I can't think of a better way.
                      > Anyone else?
                      >[/color]


                      Comment

                      • Evertjan.

                        #12
                        Re: Site Unload?

                        Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
                        [color=blue]
                        >
                        > "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
                        > news:Xns95BFD41 519566eejj99@19 4.109.133.29...[color=green]
                        >> Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
                        >>[color=darkred]
                        >> > Sigh. There has to be something for this![/color]
                        >>
                        >> [Please do not topost on usenet]
                        >>
                        >> No, you cannot detect something that is not defined.
                        >>
                        >> "leaving a site" in the logical sense has no meaning to me.[/color]
                        >
                        > It may not be formally defined,[/color]

                        It is not about a "formal definition", but what YOU mean by it defined in
                        a technical complete way.
                        [color=blue]
                        > but how about "when the host changes"?[/color]

                        The host of what?
                        Of a browser page?

                        Talking IE, when you pass to another page with shift-clicking a link, you
                        have two pages. Do you define closing one of the pages as leaving a site?

                        Even if there is one browser page, pulling the mains plug is not
                        "detected".

                        =============== ==

                        Your misconception IMHO is, that, as long as a page is on a browser, you
                        are "connected" to the "host". This is not true. "Connected" does not
                        exist in the HTML world.

                        If your employer wants this,
                        it is your task as the specialist to explain his/her folly.

                        --
                        Evertjan.
                        The Netherlands.
                        (Please change the x'es to dots in my emailaddress)

                        Comment

                        • Ross M. Greenberg

                          #13
                          Re: Site Unload?


                          "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
                          news:Xns95BFE06 3DE0F4eejj99@19 4.109.133.29...[color=blue]
                          > Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
                          >[color=green]
                          > >
                          > > "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
                          > > news:Xns95BFD41 519566eejj99@19 4.109.133.29...[color=darkred]
                          > >> Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
                          > >>
                          > >> > Sigh. There has to be something for this!
                          > >>
                          > >> [Please do not topost on usenet]
                          > >>
                          > >> No, you cannot detect something that is not defined.
                          > >>
                          > >> "leaving a site" in the logical sense has no meaning to me.[/color]
                          > >
                          > > It may not be formally defined,[/color]
                          >
                          > It is not about a "formal definition", but what YOU mean by it defined in
                          > a technical complete way.
                          >[color=green]
                          > > but how about "when the host changes"?[/color]
                          >
                          > The host of what?
                          > Of a browser page?[/color]

                          if I'm at http://www.foo.bar/whatever.htm, then going to
                          Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!


                          [color=blue]
                          >
                          > Talking IE, when you pass to another page with shift-clicking a link, you
                          > have two pages. Do you define closing one of the pages as leaving a site?[/color]

                          Nope. Just going to a "new" site.[color=blue]
                          >
                          > Even if there is one browser page, pulling the mains plug is not
                          > "detected".[/color]

                          That's why I want to detect the address of the page I'm *about* to open,
                          check the root-site.host and trigger if there's no match.


                          Comment

                          • Michael Winter

                            #14
                            Re: Site Unload?

                            On Tue, 14 Dec 2004 15:37:42 -0500, Ross M. Greenberg
                            <greenber@catsk ill.net> wrote:

                            Don't top-post and don't quote signatures!
                            [color=blue]
                            > "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
                            > news:opsi0kwiy0 x13kvk@atlantis ...[/color]

                            [snip]
                            [color=blue][color=green]
                            >> What are you trying to achieve, and why?[/color]
                            >
                            > For a commercial site, I want to open a survey page when they exit from
                            > the site from any page, but not as they transit along the site's many
                            > pages.[/color]

                            I'm afraid I'll have to be blunt: why on Earth should I, or anyone else,
                            tell you how to do that?

                            Provide a link to the survey and ask, discreetly, for visitors to fill it
                            in. If they're willing to do it, they'll activate the link and take the
                            survey. If they're not willing, they'll get annoyed, close the window, and
                            may not come back.

                            Don't annoy your users. It's the sensible, and ethical, thing to do.

                            Mike

                            --
                            Michael Winter
                            Replace ".invalid" with ".uk" to reply by e-mail.

                            Comment

                            • Ross M. Greenberg

                              #15
                              Re: Site Unload?


                              "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
                              news:opsi0o0f06 x13kvk@atlantis ...[color=blue]
                              > On Tue, 14 Dec 2004 15:37:42 -0500, Ross M. Greenberg
                              > <greenber@catsk ill.net> wrote:
                              >
                              > Don't top-post and don't quote signatures!
                              >[color=green]
                              > > "Michael Winter" <M.Winter@bluey onder.co.invali d> wrote in message
                              > > news:opsi0kwiy0 x13kvk@atlantis ...[/color]
                              >
                              > [snip]
                              >[color=green][color=darkred]
                              > >> What are you trying to achieve, and why?[/color]
                              > >
                              > > For a commercial site, I want to open a survey page when they exit from
                              > > the site from any page, but not as they transit along the site's many
                              > > pages.[/color]
                              >
                              > I'm afraid I'll have to be blunt: why on Earth should I, or anyone else,
                              > tell you how to do that?[/color]

                              Aside from the challenge?
                              [color=blue]
                              >
                              > Provide a link to the survey and ask, discreetly, for visitors to fill it
                              > in. If they're willing to do it, they'll activate the link and take the
                              > survey. If they're not willing, they'll get annoyed, close the window, and
                              > may not come back.
                              >
                              > Don't annoy your users. It's the sensible, and ethical, thing to do.
                              >[/color]
                              The survey in mind seeks to ask them directly what they liked or did not
                              like about the site. I'm seeing more than a few users leaving the site from
                              its home page. I need to find out why so I can fix what they don't like.


                              Comment

                              Working...