/    Sign up×
Community /Pin to ProfileBookmark

Hello all
If I have a window has a “newWindow”. can I somehow set the focus on that window using window object.

Please let me know ASAP

Kyle

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryJun 29.2004 — Leaving aside the fact that popups are evil, you can do this:

var myWindow = window.open(...);

then later:

myWindow.focus();

Adam
Copy linkTweet thisAlerts:
@microkarlauthorJun 29.2004 — Hey Adam

I used that method already. but there's huge drawback, if you refresh the window, the variable is gone and if the have the code like myWindow.focus(); you will get an error. and in my situation, it's not allowed.

That is the reason I am looking for other alternative way...

Thanks though

Kyle
Copy linkTweet thisAlerts:
@AdamGundryJun 30.2004 — I believe (see [url=http://home.online.no/~warnckew/programming/remote/window.html]this article[/url]) that you can do this to get the window handle again:

var myWindow = window.open('', '[i]WindowName[/i]');

Adam
×

Success!

Help @microkarl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...