I have a page that creates a popup window, then in the new window i created a new button element and attach a onclick event then attach it to the parent window.
var openerDoc = window.opener.document;
var newButton = openerDoc.createElement('button');
newButton.onclick = function(){
window.opener.fn();
return false;
}
var anElementOfParent = openerDoc.getElementById('anElementOfParentWindow');
anElementOfParent.parentNode.insertBefore(newButton,anElementOfParent);
Inside the onclick event of the new button i called a function from the parent window and it works until you close the new window.