how to send the Button Click event through Cross domain communication

Viewed 41

I want to send a button Clicking trigger event through another domain,

I'm using the cross-domain-iframe-parent-communication window.postmessage method but that's not working

<iframe src="Path/To/Html"><button id="my-btn">Start</button></iframe>

document.getElementById('my-btn').addEventListener('click', handleButtonClick, false);
function handleButtonClick(e) {
  window.parent.postMessage('iframe_message')
}

window.addEventListener('iframe_message', function() {
  window.open('some url', '_blank')
}, false);

refer link -> https://medium.com/@Farzad_YZ/cross-domain-iframe-parent-communication-403912fff692

how to solve it?

0 Answers
Related