test-iframe-postmessage.html 376 B

1234567891011121314151617181920
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script>
  6. window.addEventListener("message", function(msg) {
  7. parent.postMessage(msg.data, "*");
  8. });
  9. parent.postMessage({
  10. first: "a string",
  11. second: ["an", "array"],
  12. third: {an: 'object'}
  13. }, '*');
  14. </script>
  15. </head>
  16. <body>
  17. <h1>Inner iframe</h1>
  18. </body>
  19. </html>