Hi ,
In my application i have popup window opened via window.open from the parent page ,in the child page i add data and then submits the parent page from the child page(using window.opener.forms[0].submit())so that the added data gets reflect in the parent window and this worked fine.Now i have a new requirment that after opening the child window if the parent window is navigated to any other page the child window should get closed, so onbodyunload of the parent window i checked the reference of the childwindow not equal to "undefined" and closed the child window.This works fine ie. my child window closes when i keep my child window open and navigate the parent window to some other page.But when i add the data in the child page and submits(onunload is called now) the parent window to reflected the added data i get a permission denied error in the parent window where i try to close the child window. but i am not gettin this error constantly it occurs sometimes.
my code:
var childWindow=window.open("childWindowURL"...)
in the onunload function
if(childWindow!="undefined"){
childWindow.close() //This line gives the error.
}
both the pages are in the same domain. I dont want to use a modal window because it is not supported by all browsers. where am i going wrong
[ January 09, 2007: Message edited by: prem kamal ]