/    Sign up×
Community /Pin to ProfileBookmark

Detecting Open Windows

I haven’t found a straight answer for this yet, so I’ll just ask it.

I have a page that needs to close a window once it has loaded. All I know about the window is its name, “wait”, as in the window was opened with “window.open(url,’wait’)”.

Is there a way to find out if this window exists and then close it?

My current solution is to run “window.open(‘close.html’, ‘wait’);” where close.html just has a self.close() javascript.

The reason for this is that I have an asp.net page, I want to submit data, but if the data is bad, i want the error to display on the same page. I would like a “Please Wait” popup on the screen and after the form is done, this popup needs to close.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@crh3675Mar 05.2004 — <i>
</i>&lt;script&gt;

if (winname){
if(!winname.closed){
winnname.close();
}
}
&lt;/script&gt;
Copy linkTweet thisAlerts:
@GingerNutterMar 24.2004 — That script works fine so long as the parent window stays on the same page.(as far as I can make out anyway)

But what about if ParentWindow (on page1.htm) opens a NewWindow then moves on to a page2.htm.

How does page2.htm detect if page1.htm has opened up a window or not?
Copy linkTweet thisAlerts:
@crh3675Mar 24.2004 — You can't. That is a security feature. Once the URL changes on the opener, the opener no longer exists.
Copy linkTweet thisAlerts:
@luke0Jun 18.2004 — dose that stuff work
×

Success!

Help @gers4302 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,
)...