I have 2 Angular applications. I want to pass data from one application to another application which are running on different domain. I tried with window.postMessage but, I am not getting any data in 2nd Application.
1st Application has below code
const w = window.open('http://192.168.5.134:1210/', '');
w.postMessage('Hello Message!', 'http://localhost:4200');
2nd Application has below code
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
alert(event.origin);
if (event.origin !== "http://localhost:4200") {
return;
}
alert(event.data.data);
}