UNPKG

vis-postmonger

Version:

An ultra-lightweight Javascript utility for simplified cross-domain messaging.

43 lines (35 loc) 1.11 kB
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Postmonger - Test iframe 2</title> <!--Scripts--> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="../postmonger.js"></script> <script type="text/javascript"> $(window).on('load', function(){ var connection = new Postmonger.Session(); connection.on('test1', function(message){ $('#console').append('<div>' + message + '</div>'); connection.trigger('test1', 'iframe2 test1 received'); }); connection.on('test2', function(message){ $('#console').append(message); connection.trigger('test2', 'iframe2 test2 received'); }); }); </script> <!--Styles--> <style type="text/css"> .console { border: 1px solid #f0b1b7; margin: 0 20px 20px; min-height: 80px; padding: 10px; } </style> </head> <body> <div class="console" id="console"></div> </body> </html>