Prevent window closing

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

    Prevent window closing


    Is there a way I can prevent the browser window from being closed? I'd
    like to make sure the browser window only closes programatically (I want
    to make sure the user enters data before moving on).

    Another possible solution would be to re-open the window when it's
    closed.

    Any help is appreciated, thanks.
  • David Dorward

    #2
    Re: Prevent window closing

    danny wrote:
    [color=blue]
    > Is there a way I can prevent the browser window from being closed?[/color]

    No. (Although porn sites with hundreds of blinking banner adverts would love
    it if it were possible)
    [color=blue]
    > I'd like to make sure the browser window only closes programatically (I
    > want to make sure the user enters data before moving on).[/color]

    This is the web. You can't force the user to do anything. Make the
    application robust enough to survive the user doing the unexpected.

    --
    David Dorward <http://dorward.me.uk/>

    Comment

    • danny

      #3
      Re: Prevent window closing

      In article <bsagsp$tg$1$83 02bc10@news.dem on.co.uk>, dorward@yahoo.c om
      says...[color=blue]
      > danny wrote:
      >[color=green]
      > > Is there a way I can prevent the browser window from being closed?[/color]
      >
      > No. (Although porn sites with hundreds of blinking banner adverts would love
      > it if it were possible)[/color]

      I bet!
      [color=blue][color=green]
      > > I'd like to make sure the browser window only closes programatically (I
      > > want to make sure the user enters data before moving on).[/color]
      >
      > This is the web. You can't force the user to do anything.[/color]

      Actually, It's not for an internet application. I'm building a thin
      client application. It's a call center application, and when a contact
      is closed, they are supposed to enter data. Problem is, because it's a
      browser, they can just click the X mark and close the window, which
      leaves the contact waiting for data to move to another state. If I
      could pop the window back up and request the data again, that is
      acceptable, but I haven't yet figured that out.
      [color=blue]
      > Make the
      > application robust enough to survive the user doing the unexpected.[/color]

      Gee thanks... I thought that's what I *WAS* doing...

      Comment

      • @SM

        #4
        Re: Prevent window closing

        danny a ecrit :[color=blue]
        >
        > In article <bsagsp$tg$1$83 02bc10@news.dem on.co.uk>, dorward@yahoo.c om
        > says...[color=green]
        > > danny wrote:
        > >[color=darkred]
        > > > Is there a way I can prevent the browser window from being closed?[/color]
        > >
        > > No. (Although porn sites with hundreds of blinking banner adverts would love
        > > it if it were possible)[/color]
        >
        > I bet!
        >[color=green][color=darkred]
        > > > I'd like to make sure the browser window only closes programatically (I
        > > > want to make sure the user enters data before moving on).[/color]
        > >
        > > This is the web. You can't force the user to do anything.[/color]
        >
        > Actually, It's not for an internet application. I'm building a thin
        > client application. It's a call center application, and when a contact
        > is closed, they are supposed to enter data. Problem is, because it's a
        > browser, they can just click the X mark and close the window, which
        > leaves the contact waiting for data to move to another state. If I
        > could pop the window back up and request the data again, that is
        > acceptable, but I haven't yet figured that out.[/color]

        supose your funtion to send your data is
        function sendData(){ blah blah ; DataOk=1;}

        var DataOk =0;
        </script></head>
        <body onunload="if(Da taOk==0) sendData();"

        Would works with IE

        Comment

        • danny

          #5
          Re: Prevent window closing

          In article <3FE8D42D.17AC7 61B@wanadoo.fr> , stephane_moriau x@wanadoo.fr
          says...[color=blue]
          > danny a ecrit :[color=green]
          > >
          > > In article <bsagsp$tg$1$83 02bc10@news.dem on.co.uk>, dorward@yahoo.c om
          > > says...[color=darkred]
          > > > danny wrote:
          > > >
          > > > > Is there a way I can prevent the browser window from being closed?
          > > >
          > > > No. (Although porn sites with hundreds of blinking banner adverts would love
          > > > it if it were possible)[/color]
          > >
          > > I bet!
          > >[color=darkred]
          > > > > I'd like to make sure the browser window only closes programatically (I
          > > > > want to make sure the user enters data before moving on).
          > > >
          > > > This is the web. You can't force the user to do anything.[/color]
          > >
          > > Actually, It's not for an internet application. I'm building a thin
          > > client application. It's a call center application, and when a contact
          > > is closed, they are supposed to enter data. Problem is, because it's a
          > > browser, they can just click the X mark and close the window, which
          > > leaves the contact waiting for data to move to another state. If I
          > > could pop the window back up and request the data again, that is
          > > acceptable, but I haven't yet figured that out.[/color]
          >
          > supose your funtion to send your data is
          > function sendData(){ blah blah ; DataOk=1;}
          >
          > var DataOk =0;
          > </script></head>
          > <body onunload="if(Da taOk==0) sendData();"
          >
          > Would works with IE[/color]

          Would this prevent the window from unloading? Or would I have to handle
          that someplace else?

          Comment

          • Eric Bohlman

            #6
            Re: Prevent window closing

            danny <dan@ebji.org > wrote in
            news:MPG.1a526c 42cd6a2d5698969 4@news.newsread er.com:
            [color=blue]
            > Actually, It's not for an internet application. I'm building a thin
            > client application. It's a call center application, and when a
            > contact is closed, they are supposed to enter data. Problem is,
            > because it's a browser, they can just click the X mark and close the
            > window, which leaves the contact waiting for data to move to another
            > state. If I could pop the window back up and request the data again,
            > that is acceptable, but I haven't yet figured that out.[/color]

            You need to properly handle that on the server end since you also have to
            deal with contingencies like the client machine crashing, the client
            machine losing power, or a network outage, all of which could result in no
            data being entered at a particular state in the application.

            Comment

            • danny

              #7
              Re: Prevent window closing

              In article <Xns945AB9C7281 C7ebohlmanomsde vcom@130.133.1. 4>,
              ebohlman@earthl ink.net says...[color=blue]
              > danny <dan@ebji.org > wrote in
              > news:MPG.1a526c 42cd6a2d5698969 4@news.newsread er.com:
              >[color=green]
              > > Actually, It's not for an internet application. I'm building a thin
              > > client application. It's a call center application, and when a
              > > contact is closed, they are supposed to enter data. Problem is,
              > > because it's a browser, they can just click the X mark and close the
              > > window, which leaves the contact waiting for data to move to another
              > > state. If I could pop the window back up and request the data again,
              > > that is acceptable, but I haven't yet figured that out.[/color]
              >
              > You need to properly handle that on the server end since you also have to
              > deal with contingencies like the client machine crashing, the client
              > machine losing power, or a network outage, all of which could result in no
              > data being entered at a particular state in the application.[/color]

              Yes, the server side needs to be addressed as well (as you note, clients
              purposely closing the window isn't the only issue...) but the big
              problem is call transfer. When there's an outage, the switch drops the
              call, but when the client closes the window, the call is in limbo on the
              switch...

              Comment

              • David Dorward

                #8
                Re: Prevent window closing

                danny wrote:
                [color=blue][color=green]
                >> This is the web. You can't force the user to do anything.[/color]
                >
                > Actually, It's not for an internet application.[/color]

                If its browser based, then its as good as.
                [color=blue][color=green]
                >> Make the
                >> application robust enough to survive the user doing the unexpected.[/color][/color]
                [color=blue]
                > Gee thanks... I thought that's what I *WAS* doing...[/color]

                where the application is the code you execute on the server, not on the
                client which is beyond your control (at least if you use a normal web
                browser).

                --
                David Dorward <http://dorward.me.uk/>

                Comment

                • @SM

                  #9
                  Re: Prevent window closing

                  danny a ecrit :[color=blue]
                  >
                  > In article <3FE8D42D.17AC7 61B@wanadoo.fr> , stephane_moriau x@wanadoo.fr
                  > says...[color=green]
                  > > danny a ecrit :[color=darkred]
                  > > >
                  > > >
                  > > > It's a call center application, and when a contact
                  > > > is closed, they are supposed to enter data. Problem is, because it's a
                  > > > browser, they can just click the X mark and close the window, which
                  > > > leaves the contact waiting for data to move to another state. If I
                  > > > could pop the window back up and request the data again, that is
                  > > > acceptable, but I haven't yet figured that out.[/color]
                  > >
                  > > supose your funtion to send your data is
                  > > function sendData(){ blah blah ; DataOk=1;}
                  > >
                  > > var DataOk =0;
                  > > </script></head>
                  > > <body onunload="if(Da taOk==0) sendData();"
                  > >
                  > > Would works with IE[/color]
                  >
                  > Would this prevent the window from unloading? Or would I have to handle
                  > that someplace else?[/color]

                  that would launch your function about your state data
                  after closing the window
                  with IE it could (sometimes) works if IE is closed
                  (doesn't work on an alt+shift+del or alt+F4 )

                  to re-open the window try :

                  function reBack(){
                  open.window(sel f.location);
                  alert('You have not completed the Data question');}

                  <body onunload="rebac k();">

                  or
                  <body onunload="setTi meout('reback() ',200);">

                  Comment

                  • @SM

                    #10
                    Re: Prevent window closing

                    "@SM" a ecrit :[color=blue]
                    >
                    > to re-open the window try :
                    >
                    > function reBack(){
                    > open.window(sel f.location);
                    > alert('You have not completed the Data question');}
                    >
                    > <body onunload="rebac k();">
                    >
                    > or
                    > <body onunload="setTi meout('reback() ',200);">[/color]

                    Take care you will never more can quite this page !

                    You have to fix a conditional before

                    <body onunload="if(!m yData) reBack();">

                    *myData* would be a global variable
                    myData = false;
                    changed to "true" by your function about your Data
                    when it is called

                    Comment

                    • Cues Plus

                      #11
                      Re: Prevent window closing

                      Well sort of:

                      Here is some information on it:

                      VBS/NoClose, JS.Trojan.NoClo se
                      Type: Trojan

                      Detection: Detected by Sophos Anti-Virus since May 2002.

                      Description: JS/NoClose is a JavaScript Trojan. When an affected website is
                      accessed the Trojan will minimize Internet Explorer and attempt to access
                      other websites without the user's express permission. These sites either
                      contain advertisements or pornographic material.

                      Michael
                      --


                      Cues Plus Billiard supplies for all pool players. Pool cues, sticks, cases to protect your cues and accessories. Plus Custom cues., pool q, pool qs, stick



                      (remove SPAMBLOCK if replying by e-mail)
                      "danny" <dan@ebji.org > wrote in message
                      news:MPG.1a525d e933Wef56609989 693@news.newsre ader.com...[color=blue]
                      >
                      > Is there a way I can prevent the browser window from being closed? I'd
                      > like to make sure the browser window only closes programatically (I want
                      > to make sure the user enters data before moving on).
                      >
                      > Another possible solution would be to re-open the window when it's
                      > closed.
                      >
                      > Any help is appreciated, thanks.[/color]


                      Comment

                      • Grant Wagner

                        #12
                        Re: Prevent window closing

                        danny wrote:
                        [color=blue]
                        > In article <Xns945AB9C7281 C7ebohlmanomsde vcom@130.133.1. 4>,
                        > ebohlman@earthl ink.net says...[color=green]
                        > > danny <dan@ebji.org > wrote in
                        > > news:MPG.1a526c 42cd6a2d5698969 4@news.newsread er.com:
                        > >[color=darkred]
                        > > > Actually, It's not for an internet application. I'm building a thin
                        > > > client application. It's a call center application, and when a
                        > > > contact is closed, they are supposed to enter data. Problem is,
                        > > > because it's a browser, they can just click the X mark and close the
                        > > > window, which leaves the contact waiting for data to move to another
                        > > > state. If I could pop the window back up and request the data again,
                        > > > that is acceptable, but I haven't yet figured that out.[/color]
                        > >
                        > > You need to properly handle that on the server end since you also have to
                        > > deal with contingencies like the client machine crashing, the client
                        > > machine losing power, or a network outage, all of which could result in no
                        > > data being entered at a particular state in the application.[/color]
                        >
                        > Yes, the server side needs to be addressed as well (as you note, clients
                        > purposely closing the window isn't the only issue...) but the big
                        > problem is call transfer. When there's an outage, the switch drops the
                        > call, but when the client closes the window, the call is in limbo on the
                        > switch...[/color]

                        So you make the transaction atomic. That is to say, you don't change the state
                        of the item in the database, then ask for additional information, because if
                        the additional information is not forthcoming, the item will be in the incorrect
                        state, with missing data.

                        So instead, you record that you want to change the state of the item, you
                        request the information, and then, only if all the data was received and
                        validated properly, you change the state and update the data in the database.

                        One way to do this might be to actually introduce a new "state" for the items,
                        which says "the user requested a state change on this item", then when you
                        recieve the additional data, you change it from that state to the completed
                        state. That way, if the user requests a state change, then don't supply the
                        additional data, you have a way of notifying them of items in a pending state
                        change the next time they log in.

                        1. User requests state change
                        2. Change state from "open" to "pending closed"
                        3. User supplies additional data
                        4. If additional data is valid, change state from "pending close" to "close"

                        The next time they log in, you query the database for items in "pending close"
                        state and display "You have XX item(s) in a 'pending close' state, do you want
                        to supply the additional data for these item(s) now?" If they chose not to do
                        this, the items will remain in the "pending close" state and will be displayed
                        the next time they log in, otherwise you execute the code path for #3 above,
                        which allows them to supply the additional information, which completes the
                        state change.

                        --
                        | Grant Wagner <gwagner@agrico reunited.com>

                        * Client-side Javascript and Netscape 4 DOM Reference available at:
                        *


                        * Internet Explorer DOM Reference available at:
                        *
                        Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


                        * Netscape 6/7 DOM Reference available at:
                        * http://www.mozilla.org/docs/dom/domref/
                        * Tips for upgrading JavaScript for Netscape 7 / Mozilla
                        * http://www.mozilla.org/docs/web-deve...upgrade_2.html


                        Comment

                        Working...