I want to listen click/submit event from popup window to parent page. Here below code works if both parent and popup window belongs to same domain say http://localhost (check below commented line in code) but it will not call eventHandler method if popup has different domain say echosign.com. In below code parent window is localhost or anything other than popup.
var newWindow;
function OpenPopup() {
//newWindow = window.open("http://localhost:21930/Popup.htm", "PopupWindow", "width=300,height=100");
newWindow = window.open("https://secure.echosign.com", "PopupWindow", "width=300,height=100");
if (newWindow.addEventListener) {
newWindow.addEventListener('click', eventHandler, false);
} else {
newWindow.attachEvent('onclick', eventHandler);
}
}
function eventHandler(e) {
if (e.currentTarget.origin == "https://secure.echosign.com") {
console.log("Event from Adobe Sign!", JSON.parse(e.data));
} else {
console.log(e.currentTarget.origin);
}
}