Given the following flow:
1) User clicks on a link, opens a popup window. 2) User does some things, clicks on a button to save changes. 3) Using AJAX, some data is POSTed. 4) In the AJAX response handler, the popup is closed and the main window refreshed.
There is a problem in FireFox 2, where closing the popup within a response handler fails (until some user activity, such as mouse movement, is performed on the window).
Sample code (popup window only):
function ajax_cb()
{
window.close();
}
// Send a POST request, ajax_cb will be called when readystate == 4.
function test_ajax_close()
{
Request.sendPOST("file:///test.html", "", ajax_cb);
}
In the above sample, the window will eventually close, but first requires user interaction. According to this link:
Firefox gets unhappy if it still has a socket open doing an async AJAX request and you attempt to do a window.close().