I have an html page (main.html) that opens a new tab in the same domain using javascript using the window.open method ("newtab.html").
In a new tab, users do something, ending its action by pressing a button. At this point, I would like to send a message to the window that opens. I tried with postMessage, but from a new tab I cannot have a link to the opener.
From the new tab, I would like something like, but I have "ko"
var w = window.opener; if (w) { w.postMessage("hi", "http://10.150.10.43"); } else { alert("ko"); }
What is the best way to send a message from a secondary tab / window to the primary (in the same domain)?
Thank you very much luke
source share