/    Sign up×
Community /Pin to ProfileBookmark

window.close() not closing self in Netscape 7

I have code that opens up a child window from a main window to collect some information from a user in order to do a db lookup using xmlhttp request. Everything works fine and the result is returned and processed. However, the last line of my function is

[CODE]window.close();[/CODE]

but this is [B]not closing the window in Netscape 7[/B] (works fine in IE and FF). [B]As soon as I click anywhere on the child window, the window is then closed[/B]. It is almost as if it gets “stuck”, and the click helps it to continue. I tried adding

[CODE]window.focus();[/CODE]

before the call to

[CODE]window.close()[/CODE]

, but that did not help. I even tried using the this keyword

[CODE]this.window.focus();
this.window.close();[/CODE]

before all calls to the window object, but that did not help either.

Does anyone have any suggestions? I have never seen this before, and it seems like it is such a simple thing that I am trying to do.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorAug 29.2006 — which is the [I]event[/I] to close the pop-up? onblur, a click on a button?
Copy linkTweet thisAlerts:
@wood_tahauthorAug 30.2006 — There really is no event, per se, that triggers the popup window to close. The closing of the window is the last statement in a method. Initially, an onchange event is what triggers the opening of the new window. Then, in the new window, a regular button is clicked that invokes a method via its onclick handler. This method is used for both sending my xmlhttp request and handling the response. So, initially, the request is sent with the data that the user entered into the form. Then, the method is re-invoked once the response is received. If the response is ok, nothing happens and the window is closed. If the response indicates an error, an alert box is presented to the user, and the window is closed after the user clicks "OK" in the alert window. The window does not close in either situation.

The odd thing is that I [I]know[/I] that window.close(); works for Netscape - I have used it many times before and I am using it in a method attached to a cancel button's onclick handler, which works (the cancel button is in the popup window).

My only thought is that it has something to do with the xmlhttp request. I have not had any trouble with using it before, so I don't know what the problem could be.

Does anyone else have any ideas for me to try?
Copy linkTweet thisAlerts:
@wood_tahauthorAug 31.2006 — I know somebody out there has to have some idea ...
×

Success!

Help @wood_tah 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 5.24,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...