[0] The driving idea of showModalDialog is to have a synchronous channel of communication between the opener and the dialog. There should be some specific handshake between them. This handshake is implemented via the window.returnValue. And, the return value is at the same time captured by the opener. Whenever talk about returnValue, talk closing out of the dialog. Hence, I would say the recognized returnValue happens when the dialog is undergoing a managed-close.
[1] In your concrete case, you have to script in both the opener page and the dialog to prepare for this kind of managed close.
[1.1] Dialog
[1.1.1] Suppose your setTimeout is realized like this.
[tt]
setTimeout("window.location='xyz.htm'",1000);
[/tt]
[1.1.2]You should make it a managed close. Like this.
[tt]
setTimeout("x('xyz.htm')",1000);
[/tt]
with the handler x like this.
[tt]
function x(surl) {
window.returnValue=surl;
window.opener=self;
window.close();
}
[/tt]
[1.2] Opener
[1.2.1] When you open the dialog, suppose it is originally appearing like this.
[tt]
function y(surl) {
window.showModalDialog(surl);
//other lines...
}
[/tt]
(In this form, it is not using the modal dialog to its full, namely, the dialog nature is not exploited.)
[1.2.2] You should replace it by something like this.
[tt]
function y(surl) {
var sret=window.showModalDialog('abc.htm');
if ((typeof sret)!="undefined") {
y(sret); //relaunch the dialog with the new url
return false;
}
//other lines...
}
[/tt]
[2] The info pass back can be much more elaborated and the handshake accordingly. It is not limited to sret of type "undefined" to complete the dialog. The sret can be highly structure info and various followup action depend on it.