I can\'t seem to get this to work.
In response to a click, window A opens window B (which then has focus). Then, in response to a click on B, the window calls
I can see why a browser/OS will not allow a child windows to take over the focus (abuse of power). Here is a workaround:
JS Parent:
var child = window.open('child.html', 'child');
window.external.comeback = function() {
var back = confirm('Are you sure you want to comback?');
if(back) {
child.close();
} else {
child.focus();
}
}
JS Child:
// assuming you have jQuery
$('.btn').click() {
window.opener.external.comeback();
};
--I am using this code in a real world application to handle a checkout request that runs in child window, and I need to gracefully return to the parent window.
See: SimplifySites.com