close all child windows when close the main window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jrefactors@hotmail.com

    #1

    close all child windows when close the main window

    >From the main page, there are lots of links to open new window.
    i.e. <a href="#" onClick="window .open('child1.h tml')">Open Child
    Window</a>

    If I close the main page, I want to close all child windows also. That
    means I
    need to keep track all handles of the child windows whenever I open a
    new
    window. Correct? any suggestions on the approach?
    Please advise. thanks!!

  • porneL

    #2
    Re: close all child windows when close the main window

    [color=blue]
    > If I close the main page, I want to close all child windows also. That
    > means I need to keep track all handles of the child windows whenever I
    > open a
    > new window.[/color]

    That won't work if user browses in main window.

    IMO the best way is to simply add 'dependent=yes' to popup window
    attributes.
    Doesn't work everywhere, but when works - it works :)

    BTW: never use href="#", put real address there and use return false in
    onclick.
    This will improve search engine visibility, ensure that windows open in new
    window, links can be copied/bookmarked, etc.

    --
    * html {redirect-to: url(http://browsehappy.pl) ;}

    Comment

    • Chung Leong

      #3
      [OT] Re: close all child windows when close the main window

      <jrefactors@hot mail.com> wrote in message
      news:1105824976 .322324.115860@ f14g2000cwb.goo glegroups.com.. .[color=blue][color=green]
      > >From the main page, there are lots of links to open new window.[/color]
      > i.e. <a href="#" onClick="window .open('child1.h tml')">Open Child
      > Window</a>
      >
      > If I close the main page, I want to close all child windows also. That
      > means I
      > need to keep track all handles of the child windows whenever I open a
      > new
      > window. Correct? any suggestions on the approach?
      > Please advise. thanks!!
      >[/color]

      Yes. Wouldn't be hard if you define a Javascript function for opening
      windows and save the handles into an array.

      Or you could use the ShowModelessDia log() function. Modless dialog boxes
      stay in front of their parent window and automatically would close when the
      parent closes.


      Comment

      • Randy Webb

        #4
        Re: [OT] Re: close all child windows when close the main window

        Chung Leong wrote:[color=blue]
        > <jrefactors@hot mail.com> wrote in message
        > news:1105824976 .322324.115860@ f14g2000cwb.goo glegroups.com.. .
        >[color=green][color=darkred]
        >>>From the main page, there are lots of links to open new window.[/color]
        >>i.e. <a href="#" onClick="window .open('child1.h tml')">Open Child
        >>Window</a>
        >>
        >>If I close the main page, I want to close all child windows also. That
        >>means I
        >>need to keep track all handles of the child windows whenever I open a
        >>new
        >>window. Correct? any suggestions on the approach?
        >>Please advise. thanks!!
        >>[/color]
        >
        >
        > Yes. Wouldn't be hard if you define a Javascript function for opening
        > windows and save the handles into an array.
        >
        > Or you could use the ShowModelessDia log() function. Modless dialog boxes
        > stay in front of their parent window and automatically would close when the
        > parent closes.[/color]

        Modeless Dialogs are also IE-only.

        I might be able to understand the OT if this were not posted to
        comp.lang.javas cript


        --
        Randy
        comp.lang.javas cript FAQ - http://jibbering.com/faq

        Comment

        • Chung Leong

          #5
          Re: [OT] Re: close all child windows when close the main window

          "Randy Webb" <HikksNotAtHome @aol.com> wrote in message
          news:ioednbf4Rc zSbHTcRVn-uA@comcast.com. ..[color=blue]
          > Chung Leong wrote:[color=green]
          > > <jrefactors@hot mail.com> wrote in message
          > > news:1105824976 .322324.115860@ f14g2000cwb.goo glegroups.com.. .
          > >[color=darkred]
          > >>>From the main page, there are lots of links to open new window.
          > >>i.e. <a href="#" onClick="window .open('child1.h tml')">Open Child
          > >>Window</a>
          > >>
          > >>If I close the main page, I want to close all child windows also. That
          > >>means I
          > >>need to keep track all handles of the child windows whenever I open a
          > >>new
          > >>window. Correct? any suggestions on the approach?
          > >>Please advise. thanks!!
          > >>[/color]
          > >
          > >
          > > Yes. Wouldn't be hard if you define a Javascript function for opening
          > > windows and save the handles into an array.
          > >
          > > Or you could use the ShowModelessDia log() function. Modless dialog boxes
          > > stay in front of their parent window and automatically would close when[/color][/color]
          the[color=blue][color=green]
          > > parent closes.[/color]
          >
          > Modeless Dialogs are also IE-only.
          >
          > I might be able to understand the OT if this were not posted to
          > comp.lang.javas cript[/color]

          Oops. Why did the OP cross post into comp.lang.php?


          Comment

          Working...