Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Messaging - Receiving data
<!DOCTYPE html>
<title>Display Message</title>
function displayMessage(evt) {
var message;
if (evt.origin !== "") {
message = "You are not worthy";
else {
message = "I got " + + " from " + evt.origin;
document.getElementById("received-message").innerHTML = message;
window.addEventListener("message", displayMessage, false);
<p id="received-message">I've heard nothing yet</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment