HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> #send{ padding:5px; margin-bottom:10px; } #receiver{ width:500px; height:200px; display:block; } </style> </head> <body> <button id="send">Send Message</button> <iframe id="receiver" src="https://www.2braces.com/data-structures/demo"> <p>Your browser does not support iframes.</p> </iframe> <script> window.onload = function(){ var btn = document.getElementById('send'); var receiver = document.getElementById('receiver').contentWindow; function sendMessage(e) { e.preventDefault(); receiver.postMessage('Hello Wikimass.com!', 'https://www.2braces.com'); } btn.addEventListener('click', sendMessage); } </script> </body> </html>
OUTPUT
×

Save as Private