JavaScript & IE6: onbeforeUnload

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • R. van Laake

    #1

    JavaScript & IE6: onbeforeUnload

    Hi,

    I am building a webbased application for the office, and have full control
    over the webserver and the clientcomputers (with IE6).

    I want to prevent that the employees use Alt-F4 to close IE6. I can do that
    with the onbeforeUnload, but unfortunately I always get this messagebox:

    Are you sure you want to navigate away from this page?
    <my message>
    Press OK to continue, or Cancel to stay on the current page.

    Is there ANY way to get rid of this messagebox? I simply want "to stay on
    the current page" without having to press Cancel. (The employees can leave
    the application by pressing F12, that sets the variable
    'booleanLeaveAl lowed' to true, so they don't have to "press OK to continue"
    to leave the application).
    As I mentioned earlier, I have control over the client computers so if I can
    do it by modifying the registry, no problem. The clients have OS Windows
    Workstation 4.0.


    Thanks,

    Ray


    P.S. Please Mr. Gates, get rid of the moron that keeps on putting
    messageboxes in IE you can't disable!!!! The F3 key is also useless because
    after setting NoFindFiles (employees are not allowed to browse) you keep on
    getting a messagebox when pressing F3 without the means to disable it from
    popping up!!!!


  • rf

    #2
    Re: JavaScript &amp; IE6: onbeforeUnload

    R. van Laake wrote:
    [color=blue]
    > I am building a webbased application for the office, and have full control
    > over the webserver and the clientcomputers (with IE6).
    >
    > I want to prevent that the employees use Alt-F4 to close IE6. I can do[/color]
    that[color=blue]
    > with the onbeforeUnload, but unfortunately I always get this messagebox:[/color]

    Are you doing this to force your viewer to "log out"? If so then:

    Do you also have control over the off switch on their computer?

    Can you *ensure* that windows will never crash?

    In both cases booleanLeaveAll owed will never be true;
    [color=blue]
    > The clients have OS Windows
    > Workstation 4.0.[/color]

    That ancient?

    --
    Cheers
    Richard.


    Comment

    • Jim Ley

      #3
      Re: JavaScript &amp; IE6: onbeforeUnload

      On Mon, 8 Nov 2004 12:56:33 +0100, "R. van Laake"
      <nospam_r.vanla ake@dfk.nl> wrote:
      [color=blue]
      >Is there ANY way to get rid of this messagebox? I simply want "to stay on
      >the current page" without having to press Cancel. (The employees can leave
      >the application by pressing F12, that sets the variable
      >'booleanLeaveA llowed' to true, so they don't have to "press OK to continue"
      >to leave the application).[/color]

      Zeepe - http://www.meadroid.com/zeepe/ will let you achieve proper
      controls of this sort of application.

      Jim.

      Comment

      • R. van Laake

        #4
        Re: JavaScript &amp; IE6: onbeforeUnload

        > Are you doing this to force your viewer to "log out"?
        Yes. A number of tasks has to be performed like logging their log-off time,
        showing the employee the planning, etc.
        [color=blue]
        > Do you also have control over the off switch on their computer?[/color]
        Of course not, what a stupid question. What are you implying, that I should
        program nothing at all because the employees may turn off the computer,
        either or not intentionally?
        [color=blue]
        > Can you *ensure* that windows will never crash?[/color]
        If I could I would and probably be a billionaire overnight.
        [color=blue][color=green]
        > > The clients have OS Windows Workstation 4.0.[/color]
        > That ancient?[/color]
        Yes, that ancient. I assume you think it would be much smarter to flush 300
        NT licenses down the drain, buy 300 new XP licenses, and because of that buy
        300 new computers becauze XP doesn't run that well on a Pentium I/II, and at
        the end of the day realize that the tasks the computers are perfoming now
        are EXACTLY the same was what they were doing before you spent all that
        money. They only have to run IE6, nothing more, nothing less.


        If all you can do is be a pisser please go to a toilet instead of a
        newsgroup.




        "rf" <rf@.invalid> wrote in message
        news:tkJjd.2735 0$K7.27067@news-server.bigpond. net.au...[color=blue]
        > R. van Laake wrote:
        >[color=green]
        > > I am building a webbased application for the office, and have full[/color][/color]
        control[color=blue][color=green]
        > > over the webserver and the clientcomputers (with IE6).
        > >
        > > I want to prevent that the employees use Alt-F4 to close IE6. I can do[/color]
        > that[color=green]
        > > with the onbeforeUnload, but unfortunately I always get this messagebox:[/color]
        >
        > Are you doing this to force your viewer to "log out"? If so then:
        >
        > Do you also have control over the off switch on their computer?
        >
        > Can you *ensure* that windows will never crash?
        >
        > In both cases booleanLeaveAll owed will never be true;
        >[color=green]
        > > The clients have OS Windows
        > > Workstation 4.0.[/color]
        >
        > That ancient?
        >
        > --
        > Cheers
        > Richard.
        >
        >[/color]


        Comment

        • rf

          #5
          Re: JavaScript &amp; IE6: onbeforeUnload

          R. van Laake whined:
          [color=blue][color=green]
          > > Are you doing this to force your viewer to "log out"?[/color]
          > Yes. A number of tasks has to be performed like logging their log-off[/color]
          time,[color=blue]
          > showing the employee the planning, etc.[/color]

          So. I actually have guessed what you are really trying to do. I assume their
          log-off time is an important piece of data.
          [color=blue][color=green]
          > > Do you also have control over the off switch on their computer?[/color]
          > Of course not, what a stupid question. What are you implying, that I[/color]
          should[color=blue]
          > program nothing at all because the employees may turn off the computer,
          > either or not intentionally?[/color]

          The point of this question was to point out to you that you can not possibly
          know in all instances when a user stops using your site. So, you will never,
          in this instance, determine their log-off time.
          [color=blue][color=green]
          > > Can you *ensure* that windows will never crash?[/color]
          > If I could I would and probably be a billionaire overnight.[/color]

          The point of this question was to point out to you that you can not possibly
          know in all instances when a user stops using your site. So, you will never,
          in this instance, determine their log-off time.
          [color=blue][color=green][color=darkred]
          > > > The clients have OS Windows Workstation 4.0.[/color]
          > > That ancient?[/color]
          > Yes, that ancient.[/color]

          Sorry, that was meant to be tongue in cheek. :-)

          I am aware that many people choose to stay with NT4 for whatever reason, and
          rightly so.
          [color=blue]
          > If all you can do is be a pisser please go to a toilet instead of a
          > newsgroup.[/color]

          So, you choose to call me a pisser for asking the obvious questions? The
          questions you never even thought of?

          What would happen when you present your boss with a solution that does not
          take these quesions into account.

          What happens when he simply turns his computer off and finds that he is
          "logged-in" for the entire weekend?

          What happens when he asks you "why?".

          Would you call him a pisser?

          You can *not* determine when a user has stopped using your site. You can
          *ask* the user to tell you by using a log off link or something but you can
          not *force* this. The very best you can do is something like a session
          cookie that times out after, how long, lets pick 10 minutes. Of course then
          when your user ducks out for a coffee a log off will occur.

          --
          Cheers
          Richard.


          Comment

          • Michael Winter

            #6
            Re: JavaScript &amp; IE6: onbeforeUnload

            On Mon, 8 Nov 2004 12:56:33 +0100, R. van Laake <nospam_r.vanla ake@dfk.nl>
            wrote:

            [snip]
            [color=blue]
            > I want to prevent that the employees use Alt-F4 to close IE6. I can do
            > that with the onbeforeUnload, but unfortunately I always get this
            > messagebox:
            >
            > Are you sure you want to navigate away from this page?
            > <my message>
            > Press OK to continue, or Cancel to stay on the current page.
            >
            > Is there ANY way to get rid of this messagebox?[/color]

            No. It is a security measure. Even HTAs display the extra text.

            [snip]

            Mike

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

            Comment

            • R. van Laake

              #7
              Re: JavaScript &amp; IE6: onbeforeUnload

              Sorry that I let myself go in that way, but it seemed like the only reason
              you answered my post was to be a smartass
              [color=blue]
              > So, you choose to call me a pisser for asking the obvious questions? The
              > questions you never even thought of?[/color]

              I have been a programmer for this company for a very long time and know my
              way around these problems. Yes, I have thought of these questions, in fact
              many years ago. My previous DOS based app has worked well for years and
              answered those questions well, and the webbased thing will do so too. I just
              need to know more about the tricks behind webbased programming (most is
              ready anyway).
              [color=blue]
              > You can *not* determine when a user has stopped using your site. You can
              > *ask* the user to tell you by using a log off link or something but you[/color]
              can[color=blue]
              > not *force* this. The very best you can do is something like a session
              > cookie that times out after, how long, lets pick 10 minutes. Of course[/color]
              then[color=blue]
              > when your user ducks out for a coffee a log off will occur.[/color]

              About the session cookie: indeed, that's a way.
              We "force" the employee to log out in an orderly manner by saying he won't
              get paid if he doesn't do so... if his time isn't logged we can't bill the
              clients, so no money comes in, so there's nothing to pay him with. Obviously
              we're not that rigid, but the message does get across.
              About the toilet: apart from that it is allowed, we also have a supervisor
              to check that doesn't get out of hand.... can't expect to have the computer
              do everything for oyu.


              "rf" <rf@.invalid> wrote in message
              news:12Kjd.2750 1$K7.25644@news-server.bigpond. net.au...[color=blue]
              > R. van Laake whined:
              >[color=green][color=darkred]
              > > > Are you doing this to force your viewer to "log out"?[/color]
              > > Yes. A number of tasks has to be performed like logging their log-off[/color]
              > time,[color=green]
              > > showing the employee the planning, etc.[/color]
              >
              > So. I actually have guessed what you are really trying to do. I assume[/color]
              their[color=blue]
              > log-off time is an important piece of data.
              >[color=green][color=darkred]
              > > > Do you also have control over the off switch on their computer?[/color]
              > > Of course not, what a stupid question. What are you implying, that I[/color]
              > should[color=green]
              > > program nothing at all because the employees may turn off the computer,
              > > either or not intentionally?[/color]
              >
              > The point of this question was to point out to you that you can not[/color]
              possibly[color=blue]
              > know in all instances when a user stops using your site. So, you will[/color]
              never,[color=blue]
              > in this instance, determine their log-off time.
              >[color=green][color=darkred]
              > > > Can you *ensure* that windows will never crash?[/color]
              > > If I could I would and probably be a billionaire overnight.[/color]
              >
              > The point of this question was to point out to you that you can not[/color]
              possibly[color=blue]
              > know in all instances when a user stops using your site. So, you will[/color]
              never,[color=blue]
              > in this instance, determine their log-off time.
              >[color=green][color=darkred]
              > > > > The clients have OS Windows Workstation 4.0.
              > > > That ancient?[/color]
              > > Yes, that ancient.[/color]
              >
              > Sorry, that was meant to be tongue in cheek. :-)
              >
              > I am aware that many people choose to stay with NT4 for whatever reason,[/color]
              and[color=blue]
              > rightly so.
              >[color=green]
              > > If all you can do is be a pisser please go to a toilet instead of a
              > > newsgroup.[/color]
              >
              > So, you choose to call me a pisser for asking the obvious questions? The
              > questions you never even thought of?
              >
              > What would happen when you present your boss with a solution that does not
              > take these quesions into account.
              >
              > What happens when he simply turns his computer off and finds that he is
              > "logged-in" for the entire weekend?
              >
              > What happens when he asks you "why?".
              >
              > Would you call him a pisser?
              >
              > You can *not* determine when a user has stopped using your site. You can
              > *ask* the user to tell you by using a log off link or something but you[/color]
              can[color=blue]
              > not *force* this. The very best you can do is something like a session
              > cookie that times out after, how long, lets pick 10 minutes. Of course[/color]
              then[color=blue]
              > when your user ducks out for a coffee a log off will occur.
              >
              > --
              > Cheers
              > Richard.
              >
              >[/color]


              Comment

              • am9518

                #8
                Re: JavaScript &amp; IE6: onbeforeUnload

                function CloseIT()
                {
                window.opener=n ull; window.close(); return false;
                }

                works fine for me!
                -Aaron


                Comment

                • am9518

                  #9
                  Re: JavaScript &amp; IE6: onbeforeUnload

                  "function CloseStageIT()"
                  "{"
                  "window.opener= null; window.close(); return false;"
                  "}"

                  This works just fine for me

                  Comment

                  • am9518

                    #10
                    Re: JavaScript &amp; IE6: onbeforeUnload

                    hmmm I can't get the code to paste in the reply. It keeps closing my
                    window... hmmmm.

                    Comment

                    • Randy Webb

                      #11
                      Re: JavaScript &amp; IE6: onbeforeUnload

                      am9518 wrote:[color=blue]
                      > function CloseIT()
                      > {
                      > window.opener=n ull; window.close(); return false;
                      > }
                      >
                      > works fine for me![/color]

                      And where exactly did you test that code?

                      "works fine for me" doesn't make code that works in a cross-browser
                      environment.

                      --
                      Randy
                      comp.lang.javas cript FAQ - http://jibbering.com/faq

                      Comment

                      • Randy Webb

                        #12
                        Re: JavaScript &amp; IE6: onbeforeUnload

                        am9518 wrote:
                        [color=blue]
                        > hmmm I can't get the code to paste in the reply. It keeps closing my
                        > window... hmmmm.
                        >[/color]

                        Then use a decent newsreader instead of a website to post from.

                        --
                        Randy
                        comp.lang.javas cript FAQ - http://jibbering.com/faq

                        Comment

                        • evilmousse@gmail.com

                          #13
                          Re: JavaScript &amp; IE6: onbeforeUnload

                          [color=blue][color=green]
                          > > I want to prevent that the employees use Alt-F4 to close IE6. I can[/color][/color]
                          do[color=blue][color=green]
                          > > that with the onbeforeUnload, but unfortunately I always get this
                          > > messagebox:
                          > >
                          > > Are you sure you want to navigate away from this page?
                          > > <my message>
                          > > Press OK to continue, or Cancel to stay on the current page.
                          > >
                          > > Is there ANY way to get rid of this messagebox?[/color]
                          >
                          > No. It is a security measure. Even HTAs display the extra text.
                          >[/color]
                          [snip][color=blue]
                          > Michael Winter
                          > Replace ".invalid" with ".uk" to reply by e-mail.[/color]

                          Thank you very much for giving the closest thing to an answer I've yet
                          come accross, this is VERY hard to find info on.

                          All I want to do is switch the priority of this window so cancel is the
                          default and buttonmashers don't accidentally leave the page.

                          after days of websearching and confirm windows with verbage like
                          "false" and "null" i'd like to give some ie programmers a peice of my
                          mind...

                          Comment

                          Working...