Urgent How to prevent that Internet Explorer is closed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clemens Ortwickler

    Urgent How to prevent that Internet Explorer is closed

    Hello

    Is it possible with JavaScript to prevent that a User is closing the
    Internet Explorer? Because it is important for me that the User pushes the
    cancel Button of this webapplication how can i do this?

    Thanks for your help


  • Lasse Reichstein Nielsen

    #2
    Re: Urgent How to prevent that Internet Explorer is closed

    "Clemens Ortwickler" <ernte23@gmx.at > writes:
    [color=blue]
    > Is it possible with JavaScript to prevent that a User is closing the
    > Internet Explorer? Because it is important for me that the User pushes the
    > cancel Button of this webapplication how can i do this?[/color]

    You can't. Redesign your application.
    Will clicking your cancel button make a difference if the user isn't
    connected to the internet any more?

    You can *try* using the window.onunload handler. However, that also
    triggers if the user tries to navigate away from the window, so it's
    not your best guess. You should also expect the page to disappear,
    so don't start anything that takes time in the handler. If really
    desperate, you can open a new window (but expect every popup-blocker
    out there to try to stop it).

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Michael Winter

      #3
      Re: Urgent How to prevent that Internet Explorer is closed

      Clemens Ortwickler wrote on 25 Nov 2003:
      [color=blue]
      > Hello
      >
      > Is it possible with JavaScript to prevent that a User is closing
      > the Internet Explorer? Because it is important for me that the
      > User pushes the cancel Button of this webapplication how can i
      > do this?[/color]

      I would really hope not: pop-up writers would have a field day with
      that.

      What you might be able to do (depending on what happens when the
      cancellation occurs) is use the onunload intrinsic event to perform
      whatever action the user is supposed to. If you're trying to write a
      cookie or something similar, it should be fine. However, if it
      involves navigating to another page, it won't help.

      Mike

      --
      Michael Winter
      M.Winter@blueyo nder.co.uk.invalid (remove ".invalid" to reply)

      Comment

      • Clemens Ortwickler

        #4
        Re: Urgent How to prevent that Internet Explorer is closed

        [color=blue]
        > You can't. Redesign your application.
        > Will clicking your cancel button make a difference if the user isn't
        > connected to the internet any more?[/color]

        Thats very bad damn.... It is a local application so it doesn't matter. I
        send HTTP Request to my Application and there should be a Request when you
        click on the okay button the cancel button and when you close the Browser.
        So if I use the unload method and i push the okay button i got 2 Requests
        one for the unload handler and one for the okay button...

        thats bad really bad but nevertheless thanks for your help!


        Comment

        • Michael Winter

          #5
          Re: Urgent How to prevent that Internet Explorer is closed

          Clemens Ortwickler wrote on 25 Nov 2003:
          [color=blue][color=green]
          >> You can't. Redesign your application.
          >> Will clicking your cancel button make a difference if the user
          >> isn't connected to the internet any more?[/color]
          >
          > Thats very bad damn.... It is a local application so it doesn't
          > matter. I send HTTP Request to my Application and there should
          > be a Request when you click on the okay button the cancel button
          > and when you close the Browser. So if I use the unload method
          > and i push the okay button i got 2 Requests one for the unload
          > handler and one for the okay button...
          >
          > thats bad really bad but nevertheless thanks for your help![/color]

          You could have onclick handlers on the two buttons set a global that
          the onunload event checks. If it's set, the onunload exits without
          doing anything, and if not it does it's work. However, I'd take Mr
          Nielsen's advice and find a new approach.

          Mike

          --
          Michael Winter
          M.Winter@blueyo nder.co.uk.invalid (remove ".invalid" to reply)

          Comment

          • David Leverton

            #6
            Re: Urgent How to prevent that Internet Explorer is closed

            Clemens Ortwickler wrote:[color=blue]
            > Hello
            >
            > Is it possible with JavaScript to prevent that a User is closing the
            > Internet Explorer? Because it is important for me that the User pushes the
            > cancel Button of this webapplication how can i do this?
            >
            > Thanks for your help
            >
            >[/color]

            <strong>
            Warning: Do not close this window! If you wish to
            cancel the process, please click the "Cancel" button.
            </strong>

            Simple, and works with any browser.

            Comment

            Working...