Hi Dhanesh,
I have simulated your requirement using two html files.
1.html-
<html>
<head>
<script>
var counter = 0;
function showDialogs()
{
returnVal = window.showModalDialog("index.html",{ counter : counter , obj : window}, "dialogWidth:350px;dialogHeight:250px;center:yes;status:false;help:false;resizable:false;scroll:false");
alert('Reset the window href now');
}
</script>
</head>
<body>
<input type="button" value="Show" onclick="showDialogs();" />
</body>
</html>
Now the second html.
index.html-
<html>
<head>
<script>
function load(){
parentWindow = window.dialogArguments;
parentWindow.counter = parentWindow.counter +1;
if(window.dialogArguments.counter < 4){
document.getElementById('lbl').innerHTML = window.dialogArguments.counter;
returnVal = window.showModalDialog("index.html", {counter : parentWindow.counter , obj : parentWindow.obj},"dialogWidth:350px;dialogHeight:250px;center:yes;status:false;help:false;resizable:false;scroll:false");
setTimeout(function(){window.close()}, 2000);
} else {
setTimeout(function(){alert('Session Timeout. Closing everything');window.close()}, 1000);
}
}
</script>
</head>
<body onload="load()">
child window<label id="lbl"> </label>
</body>
</html>
Open the 1st html page. It will open 4 popups now. The last popup will have a simulation for timeout, which will trigger the close event for all the windows opened in the stack.
Thanks
Srikant