Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 17th, 2005, 05:03 PM
Registered User
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default window.close() failing to...well...close!

Hoping someone a lot smarter than me can help here!

I have a PHP app used to manage the deal lifecycle for a small start-up. Occasionally a spawned window is failing to close correctly. Here's what I have:

Main window(1) ->> spawns->> Pop-up to add/update comments(1) ->> spawns->> php script to update/save the data into mySQL(3) ->> Refreshes comments display in (1)->>closes pop up.

When page (3) finishes processing (no screen output - just a DB update from posted variabless), it writes the following javascript to the page:

<Script language=Javascript>
 window.opener.parent.comments_frame.document.locat ion.replace(<filename to refresh in a page(1) IFRAME>)

Normally all is well, the master page (1) freshes in the appropriate IFRAME, and the pop up window closes. Occassionally the processing page (3) doesn't close and the user sees just a white screen. Looking at the source the above javascript is present.

Any ideas? Uses are all on IE6, Windows XP SP2


Old October 18th, 2005, 08:01 AM
richard.york's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

I run into windows that don't close after a call to window.close() occasionally, though when I see it has been in Firefox, and only after certain events, such as an XMLHttpRequest call. To work around it I put the call to window.close() in a timeout, such as:

setTimeout('window.close();', 1);

Maybe this will work in your situation as well.



Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Old October 31st, 2005, 03:02 PM
Registered User
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks - I'll give it a try and see what happens!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close when screen saver close Rehanrana Pro VB 6 1 April 7th, 2008 03:09 AM
Window.close muthuprakash83 Javascript How-To 0 August 7th, 2006 12:35 PM
I can open a new window but can't close it camelius ASP.NET 2.0 Basics 0 March 16th, 2006 06:26 AM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM
How do i close pop-up window?: window.close () Burton HTML Code Clinic 2 September 8th, 2003 05:40 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.