Discussion Locked

Simple close-JavaScript stopped working

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

For years the simple javascriptcode for closing popup windows ("onClick='javascript:window.close(self);'") was working fine...

Until last week.. :-(

I've tried every angle: without the 'self', with 'top.window.close', etc...

Can this be a problem:
The popup is opened from my site A, showing a page from my site B. The js-code for closing is on site B.

It used to work, until last week... Without any changes to it... :-(

Are there new security issues within IE or WinXP on this?

Thanks for all your help & sugegstions!

Regards from Holland!

5 replies

by softcorp.us

Hello...

Several things:

1. The correct syntax is one of the following:

window.close();
window.self.close();
self.close();

2. By spec, JavaScript is only supposed to be able to close a window that was opened by JavaScript. Browser behavior varies. Some ignore the request (Netscape, FireFox). Others ask for permission (IE).

3. It should not matter where the JavaScript comes from (site A vs. site B).

4. Did the user upgrade to XP SP2 last week? I know of no specific change in SP2 that would cause this. But, SP2 causes lots of undesireable side-effects.

Did this help?

-----Steve Jackson

CEO/CSA
Software Corporation (Softcorp)
http://www.softcorp.us/probono
Advanced pro bono tools and utilities free for personal use

by dutchgrover

Thanks a mill for your quick & clear answer... But....

It did not help solve my problem... See my added comments with the question.

But: I really appreciate your answer & help!

by dutchgrover

Further testing shows:
* when the popup-page is opened by hand in a browser-window: the close-code shows the (normal) 'do you want to close this window' alert... So closing seems to work, but not in a popup
* the problem is not user- or PC-related: it's not working on many PC's. And: on a PC were it's not working... another popup closes with the same code... :-(
* I can send the URL tru private mail, if ness...
THANKS!

by softcorp.us

Hello again...

Yes. Please send the URL(s) by private mail. I will reproduce the problem and try to deduce the cause and solution.

---

Regarding "So closing seems to work, but not in a popup" and "on a PC were it's not working... another popup closes with the same code"

My comment: There must be someting different about the two popup windows. Perhaps something subtle.

---

Questions:

1. Any recent upgrades to SP2?
2. Any "security upgrades" to IE?
3. Which browsers and versions are experiencing the problem?
4. Please show the JavaScript code that opened the popup window that cannot be closed by JavaScript.

-----Steve Jackson

CEO/CSA
Software Corporation (Softcorp)
http://www.softcorp.us/probono
Advanced pro bono tools and utilities free for personal use

This discussion is closed to new replies.