remember all windows I opened

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

    remember all windows I opened

    Hi everybody,

    how can I remember all windows I opened to close them with one click on a
    button? (btw: do arrays exist in Javascript?)


    Harrry


  • Bas Cost Budde

    #2
    Re: remember all windows I opened

    Harald Weiser wrote:
    [color=blue]
    > Hi everybody,
    >
    > how can I remember all windows I opened to close them with one click on a
    > button? (btw: do arrays exist in Javascript?)
    >
    >
    > Harrry
    >[/color]
    Keep the references returned by window.open(). Yes, arrays exist. You
    want to use an array for this, do you?



    --
    Bas Cost Budde

    but the domain is nl

    Comment

    • Brian Genisio

      #3
      Re: remember all windows I opened

      Harald Weiser wrote:
      [color=blue]
      > Hi everybody,
      >
      > how can I remember all windows I opened to close them with one click on a
      > button? (btw: do arrays exist in Javascript?)
      >
      >
      > Harrry
      >
      >[/color]


      var myArray = new Array();

      myArray[0] = window;
      myArray[1] = window.self;
      myArray[2] = window.opener;
      //etc

      Of course, replace these windows with the windows you care about.

      Brian

      Comment

      • Harald Weiser

        #4
        Re: remember all windows I opened


        "Bas Cost Budde" <bas@heuveltop. org> schrieb im Newsbeitrag
        news:c0frhk$qnm $6@news2.solcon .nl...
        [color=blue]
        > Keep the references returned by window.open(). Yes, arrays exist. You
        > want to use an array for this, do you?
        >[/color]

        Ok. Thats exactly what I am doing now. BUT if I reload my main window, the
        array is reinstantiated and all prior values are gone :-(


        Comment

        • Brian Genisio

          #5
          Re: remember all windows I opened

          Harald Weiser wrote:
          [color=blue]
          > Ok. Thats exactly what I am doing now. BUT if I reload my main window, the
          > array is reinstantiated and all prior values are gone :-(
          >[/color]

          Yes, that is what happens when you reload the main window. Web pages
          are stateless, meaning they do not retain data on reloads. There is a
          mechanisim which can fix that... they are called cookies.

          If you want a reloaded page to have data from the previous page, you
          need to either use a cookie, or encode it in the search field of the
          URL, which is really messy. (something like yourpage.html?< your data here>

          I suppose you could also have a master window or frame, which retains
          the data you need... But that is messy too.

          Come to think of it, having multpile windows open at the same time is
          messy to begin with :)

          Brian


          Comment

          • Bas Cost Budde

            #6
            Re: remember all windows I opened

            Harald Weiser wrote:
            [color=blue]
            > "Bas Cost Budde" <bas@heuveltop. org> schrieb im Newsbeitrag
            > news:c0frhk$qnm $6@news2.solcon .nl...
            >
            >[color=green]
            >>Keep the references returned by window.open(). Yes, arrays exist. You
            >>want to use an array for this, do you?
            >>[/color]
            >
            >
            > Ok. Thats exactly what I am doing now. BUT if I reload my main window, the
            > array is reinstantiated and all prior values are gone :-([/color]

            Wenn du eine Array verwendet, warum noch danach fragen?

            But that aside. <body onunload="clean up()"> and then close all child
            windows from the cleanup function.

            Too harsh? Some other approach that comes to mind is some 'anchor
            construct', where children windows keep an eye on the parent and start a
            relinking procedure when the content refreshes.

            Does the array die as well if it sits in an external script?

            --
            Bas Cost Budde

            but the domain is nl

            Comment

            Working...