469,333 Members | 4,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,333 developers. It's quick & easy.

browser opens new windows or tabs

Is there a way for javascript to know if a browser has been set to open
new windows in tabs? I'm trying to fix some code that allows a user to
close a window that javascript opened and it seems to get confused what
window to close when a new tab is opened. (The user clicks a link in the
opened window which which opens a new window and close the current one.)

Andrew Poulos
Feb 16 '08 #1
7 2715
SAM
Andrew Poulos a écrit :
Is there a way for javascript to know if a browser has been set to open
new windows in tabs? I'm trying to fix some code that allows a user to
close a window that javascript opened and it seems to get confused what
window to close when a new tab is opened. (The user clicks a link in the
opened window which which opens a new window and close the current one.)
How do you do to close an opener ?
(supposed to be a main window which is not closable by JS)

Tabs react exactly as normal windows (in my Fx at least)

If the popup opened in a tab has a button to close it, it closes this
tab and you jump back to the tab of its opener.

--
sm

Feb 16 '08 #2
SAM <st*********************@wanadoo.fr.invalidwrite s:
Andrew Poulos a écrit :
>Is there a way for javascript to know if a browser has been set to
open new windows in tabs? I'm trying to fix some code that allows a
user to close a window that javascript opened and it seems to get
confused what window to close when a new tab is opened. (The user
clicks a link in the opened window which which opens a new window
and close the current one.)

How do you do to close an opener ?
(supposed to be a main window which is not closable by JS)

Tabs react exactly as normal windows (in my Fx at least)

If the popup opened in a tab has a button to close it, it closes this
tab and you jump back to the tab of its opener.
Not to mention that opening unrequested new windows is one of the most
annoying things you can do. Just don't do it; use plain links and let
the user sort things out to his/her preference.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Feb 16 '08 #3
SAM wrote:
Andrew Poulos a écrit :
>Is there a way for javascript to know if a browser has been set to
open new windows in tabs? I'm trying to fix some code that allows a
user to close a window that javascript opened and it seems to get
confused what window to close when a new tab is opened. (The user
clicks a link in the opened window which which opens a new window and
close the current one.)

How do you do to close an opener ?
(supposed to be a main window which is not closable by JS)

Tabs react exactly as normal windows (in my Fx at least)

If the popup opened in a tab has a button to close it, it closes this
tab and you jump back to the tab of its opener.
I'll check what is happening again but the window that is opened by
javascript which in turn opens a new window is supposed to close when
the new window is opened. Instead the new window is closing.

This is only happening in IE 7 that is set to open windows in tabs.

Andrew Poulos
Feb 16 '08 #4
Joost Diepenmaat wrote:
SAM <st*********************@wanadoo.fr.invalidwrite s:
>Andrew Poulos a écrit :
>>Is there a way for javascript to know if a browser has been set to
open new windows in tabs? I'm trying to fix some code that allows a
user to close a window that javascript opened and it seems to get
confused what window to close when a new tab is opened. (The user
clicks a link in the opened window which which opens a new window
and close the current one.)
How do you do to close an opener ?
(supposed to be a main window which is not closable by JS)

Tabs react exactly as normal windows (in my Fx at least)

If the popup opened in a tab has a button to close it, it closes this
tab and you jump back to the tab of its opener.

Not to mention that opening unrequested new windows is one of the most
annoying things you can do. Just don't do it; use plain links and let
the user sort things out to his/her preference.
1. You don't know what I'm coding.
2. You don't know who I'm coding for
3. You don't know the window is not requested.
4. I was not asking for usability advice

It is typical (so much so that the behaviour is expected) for an LMS to
automatically launch a SCO in a new window.

Andrew Poulos
Feb 16 '08 #5
Andrew Poulos wrote:
SAM wrote:
>Andrew Poulos a écrit :
>>Is there a way for javascript to know if a browser has been set to
open new windows in tabs? I'm trying to fix some code that allows a
user to close a window that javascript opened and it seems to get
confused what window to close when a new tab is opened. (The user
clicks a link in the opened window which which opens a new window and
close the current one.)

How do you do to close an opener ?
(supposed to be a main window which is not closable by JS)

Tabs react exactly as normal windows (in my Fx at least)

If the popup opened in a tab has a button to close it, it closes this
tab and you jump back to the tab of its opener.
I'll check what is happening again but the window that is opened by
javascript which in turn opens a new window is supposed to close when
the new window is opened. Instead the new window is closing.

This is only happening in IE 7 that is set to open windows in tabs.

Andrew Poulos
I am fairly sure I have this working..any chance of sample code of your
window.open() stuff?

If you track the object that this returns, you can always close the
correct window.

Closing the original window is surely simply a URL jump..or did you mean
you want to open a NEW briowser window altogthere and close the earlier
window in a tabbed session?
Feb 16 '08 #6
SAM
Andrew Poulos a écrit :
SAM wrote:
>Andrew Poulos a écrit :
>>Is there a way for javascript to know if a browser has been set to
open new windows in tabs? I'm trying to fix some code that allows a
user to close a window that javascript opened and it seems to get
confused what window to close when a new tab is opened. (The user
clicks a link in the opened window which which opens a new window and
close the current one.)

How do you do to close an opener ?
(supposed to be a main window which is not closable by JS)

Tabs react exactly as normal windows (in my Fx at least)

If the popup opened in a tab has a button to close it, it closes this
tab and you jump back to the tab of its opener.
I'll check what is happening again but the window that is opened by
javascript which in turn opens a new window is supposed to close when
the new window is opened. Instead the new window is closing.

This is only happening in IE 7 that is set to open windows in tabs.

I haven't IE and following example works fine in my Fx using tabs :
(works too in iCab.3 and Opera.9)

file 'mother.htm' :
<html>mother :
<a href="#" onclick="daughter_1=window.open('daughter_1.htm');
return false;">popup 1</a>
</html>

file 'daughter_1.htm' :
<html>daughter_1 :
<a href="#"
onclick="opener.daughter_2=daughter_2=window.open( 'daughter_2.htm');
return false;">popup 2</a>
</html>

file 'daughter_2.htm' :
<html>
<body onload="mother=opener.opener;opener.close();">
daughter_2 :
<a href="#" onclick="mother.daughter_2.close();
return false;">complex self close</a>
</html>

the popup 2 on loading closes the popup 1
closing the popup 2 (using any way) -back to mother

--
sm
Feb 16 '08 #7
Andrew Poulos <ap*****@hotmail.comwrites:
1. You don't know what I'm coding.
Ok.
2. You don't know who I'm coding for
Do you? I don't know. I don't even know what you're coding.
3. You don't know the window is not requested.
If I don't expect a full-size new window, I don't want it. For one
thing, my window manager does not size windows like you probably
expect. It sure as hell doesn't size windows the way you request. And
full-size windows are easy to request, just use a target.
4. I was not asking for usability advice
Feel free to ignore me.
It is typical (so much so that the behaviour is expected) for an LMS
to automatically launch a SCO in a new window.
What's an LMS? What's an SCO (besides that highly suspect Unix vendor)?

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Feb 22 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by olga p. | last post: by
33 posts views Thread by randau | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.