Open new window and close existing windows?

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

    #1

    Open new window and close existing windows?

    Could use your assistance with this. I have a window that opens via
    onclick and it is a small window with info about a site. If the user
    is interested in visiting that site, there is a link to click that
    opens the site in a new and larger window via onclick. My question
    is, can I have the smaller window automatically close when the user
    clicks the link to visit the site? I also have a link that merely
    closes the smaller info window if the user is not interested in
    visiting the site.

    TIA
  • Laurent Bugnion, GalaSoft

    #2
    Re: Open new window and close existing windows?

    Hi,

    Carol Lyn wrote:[color=blue]
    > Could use your assistance with this. I have a window that opens via
    > onclick and it is a small window with info about a site. If the user
    > is interested in visiting that site, there is a link to click that
    > opens the site in a new and larger window via onclick. My question
    > is, can I have the smaller window automatically close when the user
    > clicks the link to visit the site? I also have a link that merely
    > closes the smaller info window if the user is not interested in
    > visiting the site.
    >
    > TIA[/color]

    To load the link in the main window and close the small window, do:

    <A HREF="newLocati on.html"
    ONCLICK="opener .location=this. href;top.close( )return false;">
    Click here</A>

    Of course, this won't work if JavaScript is not enabled.

    Laurent
    --
    Laurent Bugnion, GalaSoft
    Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch

    Comment

    • marcy

      #3
      Re: Open new window and close existing windows?

      "Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
      message news:3F042498.9 060806@bluewin_ NO_SPAM.ch...[color=blue]
      > Hi,
      >
      > Carol Lyn wrote:[color=green]
      > > Could use your assistance with this. I have a window that opens via
      > > onclick and it is a small window with info about a site. If the user
      > > is interested in visiting that site, there is a link to click that
      > > opens the site in a new and larger window via onclick. My question
      > > is, can I have the smaller window automatically close when the user
      > > clicks the link to visit the site? I also have a link that merely
      > > closes the smaller info window if the user is not interested in
      > > visiting the site.
      > >
      > > TIA[/color]
      >
      > To load the link in the main window and close the small window, do:
      >
      > <A HREF="newLocati on.html"
      > ONCLICK="opener .location=this. href;top.close( )return false;">
      > Click here</A>
      >
      > Of course, this won't work if JavaScript is not enabled.
      >
      > Laurent[/color]

      Hello. Could this procedure also include window options, specifically,
      resizing the main window to be larger than the smaller info window that
      closes?

      Cheers,


      Comment

      • Laurent Bugnion, GalaSoft

        #4
        Re: Open new window and close existing windows?

        Hi,

        marcy wrote:[color=blue]
        > "Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
        > message news:3F042498.9 060806@bluewin_ NO_SPAM.ch...
        >[color=green]
        >>Hi,
        >>
        >>Carol Lyn wrote:
        >>[color=darkred]
        >>>Could use your assistance with this. I have a window that opens via
        >>>onclick and it is a small window with info about a site. If the user
        >>>is interested in visiting that site, there is a link to click that
        >>>opens the site in a new and larger window via onclick. My question
        >>>is, can I have the smaller window automatically close when the user
        >>>clicks the link to visit the site? I also have a link that merely
        >>>closes the smaller info window if the user is not interested in
        >>>visiting the site.
        >>>
        >>>TIA[/color]
        >>
        >>To load the link in the main window and close the small window, do:
        >>
        >><A HREF="newLocati on.html"
        >> ONCLICK="opener .location=this. href;top.close( )return false;">
        >>Click here</A>[/color][/color]

        Forgot a ';' here. Should be

        <A HREF="newLocati on.html"
        ONCLICK="opener .location=this. href;top.close( );return false;">
        Click here</A>
        [color=blue][color=green]
        >>
        >>Of course, this won't work if JavaScript is not enabled.
        >>
        >>Laurent[/color]
        >
        >
        > Hello. Could this procedure also include window options, specifically,
        > resizing the main window to be larger than the smaller info window that
        > closes?
        >
        > Cheers,[/color]

        Before I show you how to do this, note that noone likes his browser
        window to be resized. I strongly advocate against doing this.

        However, it is technically possible to resize a window from another one,
        with

        windowRef.resiz eTo( WIDTH, HEIGHT );

        For example:

        <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
        <!--

        function closeAndResize( iWidth, iHeight, strNewLoc )
        {
        opener.location = strNewLoc;
        opener.resizeTo ( iWidth, iHeight );
        top.close();
        }

        //-->
        </SCRIPT>

        <A HREF="http://www.galasoft-LB.ch"
        ONCLICK="closeA ndResize( 600, 800, this.href );return false;">
        Click here</A>

        Don't use it ;-)

        Laurent
        --
        Laurent Bugnion, GalaSoft
        Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
        Private/Malaysia: http://mypage.bluewin.ch/lbugnion
        Support children in Calcutta: http://www.calcutta-espoir.ch

        Comment

        • DU

          #5
          Re: Open new window and close existing windows?

          Laurent Bugnion, GalaSoft wrote:
          [color=blue]
          > Hi,
          >
          > marcy wrote:
          >[color=green]
          >> "Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
          >> message news:3F042498.9 060806@bluewin_ NO_SPAM.ch...
          >>[color=darkred]
          >>> Hi,
          >>>
          >>> Carol Lyn wrote:
          >>>
          >>>> Could use your assistance with this. I have a window that opens via
          >>>> onclick and it is a small window with info about a site. If the user
          >>>> is interested in visiting that site, there is a link to click that
          >>>> opens the site in a new and larger window via onclick. My question
          >>>> is, can I have the smaller window automatically close when the user
          >>>> clicks the link to visit the site? I also have a link that merely
          >>>> closes the smaller info window if the user is not interested in
          >>>> visiting the site.
          >>>>
          >>>> TIA
          >>>
          >>>
          >>> To load the link in the main window and close the small window, do:
          >>>
          >>> <A HREF="newLocati on.html"
          >>> ONCLICK="opener .location=this. href;top.close( )return false;">
          >>> Click here</A>[/color][/color]
          >
          >
          > Forgot a ';' here. Should be
          >
          > <A HREF="newLocati on.html"
          > ONCLICK="opener .location=this. href;top.close( );return false;">
          > Click here</A>
          >[color=green][color=darkred]
          >>>
          >>> Of course, this won't work if JavaScript is not enabled.
          >>>
          >>> Laurent[/color]
          >>
          >>
          >>
          >> Hello. Could this procedure also include window options, specifically,
          >> resizing the main window to be larger than the smaller info window that
          >> closes?
          >>
          >> Cheers,[/color]
          >
          >
          > Before I show you how to do this, note that noone likes his browser
          > window to be resized. I strongly advocate against doing this.
          >
          > However, it is technically possible to resize a window from another one,
          > with
          >
          > windowRef.resiz eTo( WIDTH, HEIGHT );
          >[/color]

          In NS 6.2+ and Mozilla-based browsers (NS 6.2+, K-meleon, Phoenix,
          Firebird, Beonex, etc.), there is an user setting disableing,
          neutralizing the recourse to resizeTo. So, resizeTo() can not be
          considered as a reliable method. I personally always have this setting
          turning off resizeTo() calls.

          Not to mention that Bugzilla has also enhancement requests where the
          user will utlimately have more control over and absolute veto over the
          javascript requests of web developers over window dimensions. I
          wholeheartedly agree with these people since a web developer has no idea
          how big/small is a monitor screen, how acute is the eye vision of an
          user, how crowded is the window screen, etc.. and this is outside his
          range and control. Leave the window sizes to the only person who will be
          using that window: the user. He's the best person to know what's the
          best window size for his needs.
          [color=blue]
          > For example:
          >
          > <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
          > <!--
          >
          > function closeAndResize( iWidth, iHeight, strNewLoc )
          > {
          > opener.location = strNewLoc;
          > opener.resizeTo ( iWidth, iHeight );
          > top.close();
          > }
          >
          > //-->
          > </SCRIPT>
          >
          > <A HREF="http://www.galasoft-LB.ch"
          > ONCLICK="closeA ndResize( 600, 800, this.href );return false;">[/color]

          On a 800x600 scr. res. - which is the most popular scr. res. - , the
          above instruction, if it succeeds, will create a 600x572 window because
          the requested 800 height will not fit within the available workarea for
          application. That's just a good - unintentional - example here why it is
          not recommendable to try to control the window dimensions.
          [color=blue]
          > Click here</A>
          >
          > Don't use it ;-)
          >
          > Laurent[/color]


          DU
          --
          Javascript and Browser bugs:


          Comment

          • Carol Lyn

            #6
            Re: Open new window and close existing windows?

            On Wed, 09 Jul 2003 05:06:28 -0400, DU <drunclear@hotR EMOVEmail.com>
            wrote:
            [color=blue]
            >Laurent Bugnion, GalaSoft wrote:
            >[color=green]
            >> Hi,
            >>
            >> marcy wrote:
            >>[color=darkred]
            >>> "Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_S PAM.ch> wrote in
            >>> message news:3F042498.9 060806@bluewin_ NO_SPAM.ch...
            >>>
            >>>> Hi,
            >>>>
            >>>> Carol Lyn wrote:
            >>>>
            >>>>> Could use your assistance with this. I have a window that opens via
            >>>>> onclick and it is a small window with info about a site. If the user
            >>>>> is interested in visiting that site, there is a link to click that
            >>>>> opens the site in a new and larger window via onclick. My question
            >>>>> is, can I have the smaller window automatically close when the user
            >>>>> clicks the link to visit the site? I also have a link that merely
            >>>>> closes the smaller info window if the user is not interested in
            >>>>> visiting the site.
            >>>>>
            >>>>> TIA
            >>>>
            >>>>
            >>>> To load the link in the main window and close the small window, do:
            >>>>
            >>>> <A HREF="newLocati on.html"
            >>>> ONCLICK="opener .location=this. href;top.close( )return false;">
            >>>> Click here</A>[/color]
            >>
            >>
            >> Forgot a ';' here. Should be
            >>
            >> <A HREF="newLocati on.html"
            >> ONCLICK="opener .location=this. href;top.close( );return false;">
            >> Click here</A>
            >>[color=darkred]
            >>>>
            >>>> Of course, this won't work if JavaScript is not enabled.
            >>>>
            >>>> Laurent
            >>>
            >>>
            >>>
            >>> Hello. Could this procedure also include window options, specifically,
            >>> resizing the main window to be larger than the smaller info window that
            >>> closes?
            >>>
            >>> Cheers,[/color]
            >>
            >>
            >> Before I show you how to do this, note that noone likes his browser
            >> window to be resized. I strongly advocate against doing this.
            >>
            >> However, it is technically possible to resize a window from another one,
            >> with
            >>
            >> windowRef.resiz eTo( WIDTH, HEIGHT );
            >>[/color]
            >
            >In NS 6.2+ and Mozilla-based browsers (NS 6.2+, K-meleon, Phoenix,
            >Firebird, Beonex, etc.), there is an user setting disableing,
            >neutralizing the recourse to resizeTo. So, resizeTo() can not be
            >considered as a reliable method. I personally always have this setting
            >turning off resizeTo() calls.
            >
            >Not to mention that Bugzilla has also enhancement requests where the
            >user will utlimately have more control over and absolute veto over the
            >javascript requests of web developers over window dimensions. I
            >wholehearted ly agree with these people since a web developer has no idea
            >how big/small is a monitor screen, how acute is the eye vision of an
            >user, how crowded is the window screen, etc.. and this is outside his
            >range and control. Leave the window sizes to the only person who will be
            >using that window: the user. He's the best person to know what's the
            >best window size for his needs.
            >[color=green]
            >> For example:
            >>
            >> <SCRIPT LANGUAGE="JavaS cript" TYPE="text/javascript">
            >> <!--
            >>
            >> function closeAndResize( iWidth, iHeight, strNewLoc )
            >> {
            >> opener.location = strNewLoc;
            >> opener.resizeTo ( iWidth, iHeight );
            >> top.close();
            >> }
            >>
            >> //-->
            >> </SCRIPT>
            >>
            >> <A HREF="http://www.galasoft-LB.ch"
            >> ONCLICK="closeA ndResize( 600, 800, this.href );return false;">[/color]
            >
            >On a 800x600 scr. res. - which is the most popular scr. res. - , the
            >above instruction, if it succeeds, will create a 600x572 window because
            >the requested 800 height will not fit within the available workarea for
            >application. That's just a good - unintentional - example here why it is
            >not recommendable to try to control the window dimensions.
            >[color=green]
            >> Click here</A>
            >>
            >> Don't use it ;-)
            >>
            >> Laurent[/color]
            >
            >
            >DU[/color]

            Yes, I have taken the advice and it works out best. Actually,
            Laurent's follow-up mentioning the semi-colon made all the difference
            (thank you for returning with that info) because our new window was
            opening in the much smaller info window. That's why I was curious
            about the ability to resize the new window. But making that
            semi-colon adjustment solved that issue and the new window opens up
            full while the smaller info window goes away. Perfect. Thanks, All,
            for your assistance!

            Comment

            Working...