javascript - Window onmessage/message event does not work in IE -
i trying data external window of messageevent of java script.
function damcallback() { var callbackurl = 'url redirected'; var mywindow = window.open(callbackurl, "select content", "width=750,height=550"); // create ie + others compatible event handler var eventmethod = window.addeventlistener ? "addeventlistener" : "attachevent"; var eventer = window[eventmethod]; var messageevent = eventmethod == "attachevent" ? "onmessage" : "message"; // listen message child window eventer(messageevent, function(e) { var datareceived = json.parse(e.data); var imageid = datareceived.data[0].assetid; alert(imageid); if (datareceived) { mywindow.close(); } else { console.log("looks have not received data. here data " + datareceived + " "); } }, false); }
this working fine in both chrome , firefox. failed work in ie. reason not work on ie?
i have gone through message | onmessage in ie. no luck
wiki
Comments
Post a Comment