Page 1 of 1

Problem with Close and Refresh function

Posted: Sun Dec 04, 2005 3:02 pm
by mchaggis
Hi,

I have the following function which I use when popup windows are closed (that have been used to edit the data).

Code: Select all

function CloseRefresh() {
        window.opener.location.reload();
        window.close();
}
This function of course works a charm. Until of course the parent page was loaded with the post method and you get the annoying message asking if you want to post data again.

The following change to the function, seems to combat this:

Code: Select all

function CloseRefresh() {
        window.opener.location=window.opener.location;
        window.close();
}
Although, it would appear that if a page is loaded using the standard get method, it doesn't always do anything, more than likely due to browsers being a bit too clever.

What I'd like to do is develop a hybrid, something like the following:

Code: Select all

function CloseRefresh() {
        if (window.opener.requestmethod=='post') {
                window.opener.location=window.opener.location;
        } else {
                window.opener.location.reload();
        }

        window.close();
}
Anyone have any ideas?

Cheers