Close window without messagebox

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

    Close window without messagebox

    Hello there

    Is it possible to close a window without the messagebox coming up asking if
    you really want to close the window?


    Steven


  • Stuart Palmer

    #2
    Re: Close window without messagebox

    Only if it's not the last main browser window i.e not a popup.

    I believe the answer is no.

    Stu

    "Steven Malcolm" <misssewandsew@ ozemail.com.au> wrote in message
    news:9AU1c.66$d l4.3235@nnrp1.o zemail.com.au.. .[color=blue]
    > Hello there
    >
    > Is it possible to close a window without the messagebox coming up asking[/color]
    if[color=blue]
    > you really want to close the window?
    >
    >
    > Steven
    >
    >[/color]


    Comment

    • Silvio Bierman

      #3
      Re: Close window without messagebox


      "Steven Malcolm" <misssewandsew@ ozemail.com.au> wrote in message
      news:9AU1c.66$d l4.3235@nnrp1.o zemail.com.au.. .[color=blue]
      > Hello there
      >
      > Is it possible to close a window without the messagebox coming up asking[/color]
      if[color=blue]
      > you really want to close the window?
      >
      >
      > Steven
      >
      >[/color]

      Depends. Most browsers will not let you do this, IE (at least the more
      recent versions) will. To do it in IE use:

      window.opener = window;
      window.close();

      IE seems to conclude that when a window has an opener it is not a top-level
      window. This could break in any future version naturally but for now you can
      save some users some trouble.

      Silvio Bierman


      Comment

      • Michael Winter

        #4
        Re: Close window without messagebox

        On Fri, 5 Mar 2004 11:23:40 +0100, Silvio Bierman <sbierman@idfix .nl>
        wrote:

        [snip]
        [color=blue]
        > IE seems to conclude that when a window has an opener it is not a
        > top-level window. This could break in any future version naturally
        > but for now you can save some users some trouble.[/color]

        An intentionally introduced security vulnerability? What on Earth
        possessed Microsoft to do this? JavaScript "developers " that complained
        they couldn't close browser windows at their discretion, even when the
        user might not want it to happen?

        Mike

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

        Comment

        • Richard Cornford

          #5
          Re: Close window without messagebox

          Michael Winter wrote:[color=blue]
          > Silvio Bierman wrote:
          > [snip]
          >[color=green]
          >> IE seems to conclude that when a window has an opener it
          >> is not a top-level window. This could break in any future
          >> version naturally but for now you can save some users some
          >> trouble.[/color]
          >
          > An intentionally introduced security vulnerability? What
          > on Earth possessed Microsoft to do this? ...[/color]
          <snip>

          It is not so much introduced, more as yet unpatched. IE browsers (and a
          fair number of others) have suffered from it for years. It doesn't get
          publicised much on this group because rather than saving "users some
          trouble", closing the users browser without their consent destroys
          everything it continued, possibly including their browsing history,
          session cookies, partly filled in form information, etc. So in reality,
          predictably causing the user trouble. The people who ask the question
          don't understand web browsers sufficiently to appreciate the harm such
          an action can do, else they would never think such a thing was a god
          idea.

          The practical upshot of any wide dissemination of the hack, and its use
          by inconsiderate web authors, will be that content-inserting proxies
          will be distributed with built in filters to jump on either references
          to the - window.close - method or the - opener - property. Moving
          cross-window interaction even further into the realm of "too unreliable
          to consider for Internet use". There are no shortage of javascript
          authors who never consider the impact of their actions on users,
          themselves or browser scripting as a task; whiteness the pop-up window.

          Richard.


          Comment

          • Randy Webb

            #6
            Re: Close window without messagebox

            Michael Winter wrote:[color=blue]
            > On Fri, 5 Mar 2004 11:23:40 +0100, Silvio Bierman <sbierman@idfix .nl>
            > wrote:
            >
            > [snip]
            >[color=green]
            >> IE seems to conclude that when a window has an opener it is not a
            >> top-level window. This could break in any future version naturally
            >> but for now you can save some users some trouble.[/color]
            >
            >
            > An intentionally introduced security vulnerability? What on Earth
            > possessed Microsoft to do this? JavaScript "developers " that complained
            > they couldn't close browser windows at their discretion, even when the
            > user might not want it to happen?
            >
            > Mike
            >[/color]

            Search the archives for "The unconditional truth" and you will find a
            partial list of browsers that have that "feature" and it is far from
            limited to Microsoft.

            --
            Randy
            Chance Favors The Prepared Mind
            comp.lang.javas cript FAQ - http://jibbering.com/faq/

            Comment

            • Steven Malcolm

              #7
              Re: Close window without messagebox


              Thanks for your answer, but excuse my ignorance, but I know next to
              nothing about javascript.

              How do I actually use

              window.opener = window;
              window.close();


              Thanks


              Steven


              *** Sent via Developersdex http://www.developersdex.com ***
              Don't just participate in USENET...get rewarded for it!

              Comment

              • Steven Malcolm

                #8
                Re: Close window without messagebox

                Thanks for your reply.

                The reason I need to be able to close the web browser window is this.

                I am writing a database at work which will work of a touchscreen at the
                reception desk, and be used as a check-in/check-out system. Part of
                this is that new visitors are taken through a short induction, which is
                in the form of html pages(and I cannot change them to anything else),
                and at the end of the presentation I need to be able to close the
                browser and return to the database.

                Thanks


                Steven



                *** Sent via Developersdex http://www.developersdex.com ***
                Don't just participate in USENET...get rewarded for it!

                Comment

                • Randy Webb

                  #9
                  Re: Close window without messagebox

                  Steven Malcolm wrote:
                  [color=blue]
                  > Thanks for your answer, but excuse my ignorance, but I know next to
                  > nothing about javascript.
                  >
                  > How do I actually use
                  >
                  > window.opener = window;
                  > window.close();
                  >[/color]

                  From your other reply, you are working in an intranet environment and
                  as such, you have more control over what browser is used. If you can
                  modify the last .html in the intro course, then you add the above
                  snippet in the last page in a script block.

                  --
                  Randy
                  Chance Favors The Prepared Mind
                  comp.lang.javas cript FAQ - http://jibbering.com/faq/

                  Comment

                  • find clausen

                    #10
                    Re: Close window without messagebox

                    On Fri, 5 Mar 2004 06:40:50 -0000, "Stuart Palmer"
                    <stuartglenpalm er@ntlworld.com > wrote:
                    [color=blue]
                    > Only if it's not the last main browser window i.e not a popup.[/color]

                    Or _blank ...

                    --

                    find clausen

                    Comment

                    Working...