I am attempting to close a child window, but have encountered some extremely bizarre behavior in webkit-based browsers - it doesn't work! Here's the HTML snippet of the parent:
var winBrowser = null;
function openWindow(strAction) {
switch(strAction) {
case "req":
winBrowser = window.open(...);
ajax(...);
break;
case "succ":
// window.open(...);
break;
case "fail":
winBrowser.close();
// winBrowser.closeMe();
break;
}
}
The function is initially called with 'req' as the strAction value. The 'ajax' call in that segment calls the same function again but with a 'succ' or 'fail' parameter depending on the result from the ajax call itself. At first I attempted to simply open the child window upon success, but this failed in webkit-based browsers. So I adjusted the code to load a blank window in the 'req' section and close it if the ajax call failed - as a work around. However, the close(); call doesn't work either. Any thoughts on a resolution?
UPDATE:
I've also attempted on calling a javascript function in the child window that simply attempts to close the child window:
function closeMe(){ window.close(); }