Gecko DOM window onclose event ?

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

    Gecko DOM window onclose event ?

    As in topic... has anyone used it ?

    I tried to use it but i guess i failed... here is a code:

    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    function closedWin() {
    confirm("close ?");
    return false; /* which will not allow to close the window */
    }
    if(window.addEv entListener) {
    window.addEvent Listener("close ", closedWin, false);
    }

    window.onclose = closedWin;
    </script>
    </head>
    <body>

    </body>
    </html>

    Please try and lighten me :-)...

  • Danny

    #2
    Re: Gecko DOM window onclose event ?




    is not .onclose, is .onunload :).

    Danny

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Gecko DOM window onclose event ?

      Danny wrote:
      [color=blue]
      > is not .onclose, is .onunload :).[/color]

      It is well known that the `unload' event also fires when the document is
      unloaded, i.e. when the location changes. Please get informed before you
      try to help here.


      PointedEars

      Comment

      • Luke Matuszewski

        #4
        Re: Gecko DOM window onclose event ?


        Thomas 'PointedEars' Lahn napisal(a):[color=blue]
        > Danny wrote:
        >[color=green]
        > > is not .onclose, is .onunload :).[/color]
        >
        > It is well known that the `unload' event also fires when the document is
        > unloaded, i.e. when the location changes. Please get informed before you
        > try to help here.
        >[/color]

        Yes.
        Question in topic refers to my older post on How to detect that a user
        closes a user agent window - where i suggested the spying popup which
        examines window.opener (window.opener. closed) properties.
        I ask about onclose, because i wanted to attach that event on Gecko
        browsers - and further if such attach will work i could disable spying
        popup - all necessery logout via img.src will be done in onclose event
        and not in spying popup (so questions from users of Gecko browsers in
        style: "Why this popup shows and quickly closes when i click/write/go
        to another ulr ?" will probably never rise... only from IE users).

        Still waitin for answer on topic question...

        PS i tried to open window in JS (popup via window.open) and added to
        returned reference the event onclose... closed the opened window but
        onclose was not fired :(
        [code]
        <html>
        <head>
        <title></title>
        <script type="text/javascript">
        function testingPopup(ev t) {
        spyWin = window.open('pa ge2.html','test ing',
        'width=100,heig ht=100,left=100 ,top=0,status=0 ');
        spyWin.addEvent Listener("close ", closedWin, false);
        spyWin.onclose = closedWin;
        }
        function closedWin() {
        confirm("close ?");
        return false;
        }
        if(window.attac hEvent) {
        window.attachEv ent("onunload", testingPopup);
        } else {
        if(window.addEv entListener) {
        window.addEvent Listener("unloa d", testingPopup, false);
        } else {
        window.onunload = testingPopup;
        }
        }

        </script>
        </head>
        <body>

        </body>
        </html>




        [color=blue]
        >
        > PointedEars[/color]

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: Gecko DOM window onclose event ?

          Luke Matuszewski wrote:
          [color=blue]
          > Thomas 'PointedEars' Lahn napisal(a):[color=green]
          >> Danny wrote:[color=darkred]
          >> > is not .onclose, is .onunload :).[/color]
          >>
          >> It is well known that the `unload' event also fires when the document is
          >> unloaded, i.e. when the location changes. Please get informed before you
          >> try to help here.[/color]
          >
          > Yes.
          > Question in topic refers to my older post[/color]

          Threads should be continued if the subject virtually is the same.
          [color=blue]
          > on How to detect that a user closes a user agent window - where i
          > suggested the spying popup which examines window.opener
          > (window.opener. closed) properties. I ask about onclose, because i
          > wanted to attach that event on Gecko browsers[/color]

          1. `onclose' is not an event, it is an event handler. The respective event
          would be named `close'. However, there is of course no such event in
          W3C DOM Level 2 Events (or the Working Group Note on DOM Level 3 Events),
          so using addEventListene r() is not very likely to work in the first
          place.

          2. You cannot add previously unsupported event handlers to the implemented
          DOM.

          3. The Gecko DOM appears to support such an event handler:

          <URL:http://developer.mozil la.org/en/docs/DOM:window#Even t_Handlers>

          Historically, event handlers can be assigned event listeners with
          assignment of a Function object reference to the respective property
          of the target object. However, it is not described that returning a
          false-value will cancel the respective event.
          [color=blue]
          > PS i tried to open window in JS (popup via window.open) and added to
          > returned reference the event onclose... closed the opened window but
          > onclose was not fired :([/color]

          So, ignoring that your examples were not Valid HTML, the event handler
          appears not to be supported yet or not longer to be supported in the
          Gecko DOM.

          Would you please learn to quote?


          PointedEars

          Comment

          • Luke Matuszewski

            #6
            Re: Gecko DOM window onclose event ?


            Thomas 'PointedEars' Lahn napisal(a):[color=blue]
            > So, ignoring that your examples were not Valid HTML, the event handler
            > appears not to be supported yet or not longer to be supported in the
            > Gecko DOM.
            >[/color]

            Probably thats why it is colored red on
            The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.

            , but it makes no excuse for them to inform developer that 'red' events
            are not supported. This is my assumption, but maybe someone more
            knowing will lighten the 'red' events.
            [color=blue]
            > Would you please learn to quote?[/color]

            Looks good here ?
            [color=blue]
            > PointedEars[/color]

            Luke

            Comment

            • Thomas 'PointedEars' Lahn

              #7
              Re: Gecko DOM window onclose event ?

              Luke Matuszewski wrote:
              [color=blue]
              > Thomas 'PointedEars' Lahn napisal(a):[color=green]
              >> So, ignoring that your examples were not Valid HTML, the event handler
              >> appears not to be supported yet or not longer to be supported in the
              >> Gecko DOM.[/color]
              >
              > Probably thats why it is colored red on
              > http://developer.mozilla.org/en/docs...Event_Handlers[/color]

              It is possible, but not very likely. That is a Wiki and links colored
              different there indicate links to documents that have not been written yet.
              [color=blue]
              > , but it makes no excuse for them to inform developer that 'red'
              > events are not supported. This is my assumption, but maybe someone
              > more knowing will lighten the 'red' events.[/color]

              You have yet to understand what a Wiki is. Click the link.
              [color=blue][color=green]
              >> Would you please learn to quote?[/color]
              >
              > Looks good here ?[/color]

              No. Signatures (literal and technical meaning) are not to be quoted unless
              one referrs to them directly. And _all_ quoted material that has no direct
              reference should be removed from the followup before it is posted.


              PointedEars

              Comment

              Working...