focus initial window after opening a few more

S

spx2

Hi,

I'm opening some windows using window.open()
When that is done, I check window.document.title and I see that the
window object has
stayed unchanged throughout the opening of the new windows( although ,
now , the last of the opened windows
has focus ).
So I thought , if the "window" object is still refering to the initial
window I'll do window.focus() to focus it.
That didn't work.
I then tried window.blur() and then window.focus() , that didn't work
either.
How can I make the initial window get focus again ?

I look forward to any suggestions that you might have regarding this.

Thank you,
Stefan
 
M

Martin Honnen

spx2 said:
I'm opening some windows using window.open()
When that is done, I check window.document.title and I see that the
window object has
stayed unchanged throughout the opening of the new windows( although ,
now , the last of the opened windows
has focus ).
So I thought , if the "window" object is still refering to the initial
window I'll do window.focus() to focus it.
That didn't work.

The browser might not allow script to do that, check the browser
preferences/settings whether script is allowed to lower/raise windows.
 
S

SAM

Le 9/22/09 1:31 PM, spx2 a écrit :
Hi,

I'm opening some windows using window.open()

all from same mother ? each one opened by same script in 1st window ?
(all are children of same file/window ?)
When that is done, I check window.document.title and I see that the
window object has
stayed unchanged throughout the opening of the new windows( although ,
now , the last of the opened windows has focus ).

Once more, from where do you call window.document.title ?
(normally that would have to give you the title of the document the
script come from)(the script looks at its own window)
So I thought , if the "window" object is still refering to the initial
window I'll do window.focus() to focus it.
That didn't work.

and : self.focus(); what does that give ?
I then tried window.blur() and then window.focus() , that didn't work
either.
How can I make the initial window get focus again ?

from one of the daughters : if(opener) opener.focus();

from the mother : self.focus();
 
S

Stefan Petrea

Hi Stephane,

And thanks for taking the time

Le 9/22/09 1:31 PM, spx2 a écrit :



all from same mother ? each one opened by same script in 1st window ?
(all are children of same file/window ?)

from the same parent yes(mother if you will...)
Once more, from where do you call window.document.title ?
(normally that would have to give you the title of the document the
script come from)(the script looks at its own window)

from the initial window( from where all new windows have been created
from ).
and :  self.focus();   what does that give  ?

also doesn't work
from one of the daughters :   if(opener) opener.focus();

where did this new variable named "opener" came from ?
I presume you meant window.opener right ?
( I found it documented here -> https://developer.mozilla.org/en/DOM/window..opener
)

didn't work(although I shouldn't have tried it from the very
beggining)
from the mother :  self.focus();

didn't work(this should have worked)

Best Regards,
Stefan
 
S

Stefan Petrea

The browser might not allow script to do that, check the browser
preferences/settings whether script is allowed to lower/raise windows.

I need this to work on ff2 and onwards or opera.
I cannot afford to modify any of the browser's settings because this
is a web app
and it does not have such priviledges.
 
S

SAM

Le 9/23/09 1:41 PM, Stefan Petrea a écrit :
Hi Stephane,

And thanks for taking the time



from the same parent yes(mother if you will...)

mother -> daughter -> re-daughter

from any of the daughters ou daughter of daughter :

var op = window.opener;
while(op) op = op.opener;
alert('grand grand mother title = '+op.document.title;

from the initial window( from where all new windows have been created
from ).

So, from the initial window :
alert(window.document.title);
will have to give you the title of this window.
also doesn't work

at which moment do you (try to) give back focus to the mother window ?
where did this new variable named "opener" came from ?
I presume you meant window.opener right ?

absolutly,
I learnd that 'window' in intrinsic (may be to do not specified)

of course you did also see :
https://developer.mozilla.org/en/DOM/window
That page is all what you have to know about 'window'
and can link to window.open() :
https://developer.mozilla.org/en/DOM/window.open
didn't work(although I shouldn't have tried it from the very
beggining)

didn't work(this should have worked)

Exercices (in french) :
http://stephane.moriaux.pagesperso-orange.fr/truc/popup_oui_non/
http://stephane.moriaux.pagesperso-orange.fr/truc/popup_suivi/
(21 w3c errors ...)
 
S

SAM

Le 9/23/09 1:43 PM, Stefan Petrea a écrit :
is spx2 the same person as Stefan Petrea ?
and also same person as Martin Honnen ?

Are they empty ?
Have they a file displayed in them ?
or the document is created by JS ?

When and what "is done" ? (how do you tempt to detect that ?)

are the popups that open each of them a popup ?
(popup that will open a new one and so on)
I need this to work on ff2 and onwards or opera.


No more FF2 for testing.
Fx3 and Opera 9.6 : OK
I cannot afford to modify any of the browser's settings because this
is a web app
and it does not have such priviledges.


What is not working at this address above ?

What do you want to modify in the 7 JS files (all named the same name)
fron 10 to 20ko each one?

Seen no popup there.
 
S

Stefan Petrea

Hi SAM,

Le 9/23/09 1:43 PM, Stefan Petrea a écrit :


is spx2 the same person as Stefan Petrea ?
yes

and also same person as Martin Honnen ?
no


Are they empty ?

no , they have some stuff on them
Have they a file displayed in them ?
yes

or the document is created by JS ?

maybe some js as well
( actually they're some random urls pointing to some web pages , how
does it matter if they are static pages or if they contain JS ? )
When and what "is done" ? (how do you tempt to detect that ?)

"what" = all the window.open calls have been completed made
(no , not all the opened pages are completely loaded)

284 $("#open_links_new_tabs").click(function(){
285 // opens the links in the items in new
tabs
286 var i = 0;
287 $(".table_row > td > a").each(function(w)
{
288 i++;
289
290 openedWindows.push(
291 window.open($(this).attr
('href'),'opened_link'+i);
292 );
293
294
295 });
296
297 window.focus();
298 });

are the popups that open each of them a popup ?

no, the window that opens them is a normal one, a tab from the
browser ... nothing special
(popup that will open a new one and so on)

You might be a little bit confused, I didn't say that:
window -> opens a popup -> which in turn opens another popup -> which
in turn opens another popup...
I said:

window1 -> opens popup
window1 -> opens another one
window1 -> and another one
window1 -> yet another one

and so forth
No more FF2 for testing.
Fx3 and Opera 9.6 : OK

:) no probleme here.
What is not working at this address above ?

the address in question is not mine , nor have I made reference to it,
it belongs to Martin Honnen , who is a member of this group.
What do you want to modify in the 7 JS files (all named the same name)
fron 10 to 20ko each one?

Seen no popup there.

again, I was not refering to that web page.

Best regards,
Stefan
 
S

SAM

Le 9/24/09 3:59 AM, Stefan Petrea a écrit :

Hi Stef,
Ha!


"what" = all the window.open calls have been completed made
(no , not all the opened pages are completely loaded)

I can't do openning a "new window" in a tab (in any of my browsers).
But I can open (and close) a list of links in popups.
284 $("#open_links_new_tabs").click(function(){

Bon! là je lache la rampe!
Aren't you using a JS library to try to do what you want ?
What did say you the guys on its forum ?
285 // opens the links in the items in new
tabs
286 var i = 0;
287 $(".table_row > td > a").each(function(w)
{
288 i++;
289
290 openedWindows.push(

return window.open(blah...);
no ?
291 window.open($(this).attr
('href'),'opened_link'+i);
292 );
293
294
295 });
296
297 window.focus();
298 });



You might be a little bit confused, I didn't say that:
window -> opens a popup -> which in turn opens another popup -> which
in turn opens another popup...

You were not very explicit on this point.

No, you said :
« I'm opening some windows using window.open() »
window1 -> opens popup
window1 -> opens another one
window1 -> and another one
window1 -> yet another one

and so forth
OK

that does.
:) no probleme here.

I did mean by "OK", that that opens new windows and set back the focus
to the common mother (tabs are another question) in my tests in "normal"
JS without lib.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top