473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
Jul 20 '05 #1
5 9680
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="newLocation.html"
ONCLICK="opener.location=this.href;top.close()retu rn 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

Jul 20 '05 #2
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3F042498.9060806@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="newLocation.html"
ONCLICK="opener.location=this.href;top.close()retu rn false;">
Click here</A>

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,
Jul 20 '05 #3
Hi,

marcy wrote:
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3F042498.9060806@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="newLocation.html"
ONCLICK="opener.location=this.href;top.close()retu rn false;">
Click here</A>
Forgot a ';' here. Should be

<A HREF="newLocation.html"
ONCLICK="opener.location=this.href;top.close();ret urn false;">
Click here</A>

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,


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.resizeTo( WIDTH, HEIGHT );

For example:

<SCRIPT LANGUAGE="JavaScript" 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="closeAndResize( 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

Jul 20 '05 #4
DU
Laurent Bugnion, GalaSoft wrote:
Hi,

marcy wrote:
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3F042498.9060806@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="newLocation.html"
ONCLICK="opener.location=this.href;top.close()retu rn false;">
Click here</A>

Forgot a ';' here. Should be

<A HREF="newLocation.html"
ONCLICK="opener.location=this.href;top.close();ret urn false;">
Click here</A>

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,

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.resizeTo( WIDTH, HEIGHT );


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.
For example:

<SCRIPT LANGUAGE="JavaScript" 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="closeAndResize( 600, 800, this.href );return false;">
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.
Click here</A>

Don't use it ;-)

Laurent

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/

Jul 20 '05 #5
On Wed, 09 Jul 2003 05:06:28 -0400, DU <dr*******@hotREMOVEmail.com>
wrote:
Laurent Bugnion, GalaSoft wrote:
Hi,

marcy wrote:
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3F042498.9060806@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="newLocation.html"
ONCLICK="opener.location=this.href;top.close()retu rn false;">
Click here</A>

Forgot a ';' here. Should be

<A HREF="newLocation.html"
ONCLICK="opener.location=this.href;top.close();ret urn false;">
Click here</A>

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,

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.resizeTo( WIDTH, HEIGHT );


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.
For example:

<SCRIPT LANGUAGE="JavaScript" 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="closeAndResize( 600, 800, this.href );return false;">


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.
Click here</A>

Don't use it ;-)

Laurent

DU


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!
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
4
by: Phillip Parr | last post by:
Hello, I have a nice system where someone clicks on a picture to show the full version. This pops up in a window.open box. It works great, the only problem is that if the user clicks a second...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
18
by: Roger Withnell | last post by:
I open a new window from the current window to display maps. Several maps of different sizes can be displayed. The function is given the size of the map and adjusts the window size accordingly....
1
by: RJN | last post by:
Hi Sorry for posting again. I open a few pop-up windows from a main window. If session time out occurs in either the main window or the pop-up windows ,I redirect the user to login screen....
4
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park...
4
by: NC | last post by:
Hi All, We have an issue where if we say: window.open(uri, 'QuickTradePopup', 'width=730,height=300,menubar=no,toolbar=no,scrollbars=yes,resizable=yes').
2
by: Buddha Pest | last post by:
The 1st window opens the 2nd window. The 2nd window opens the 3rd window. From the 3rd window, how do I close the 3rd and 2nd windows then change the URL of the 1st window? Thanks.
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.