From aca3406249a0f7138d956aad2f2e4d3e3a64b8e2 Mon Sep 17 00:00:00 2001 From: marrionluaka Date: Tue, 19 Sep 2023 16:42:26 -0700 Subject: [PATCH] Fixing channel messaging type error --- channel-messaging-basic/page2.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/channel-messaging-basic/page2.html b/channel-messaging-basic/page2.html index 3929fec5..d5d36c11 100644 --- a/channel-messaging-basic/page2.html +++ b/channel-messaging-basic/page2.html @@ -14,6 +14,8 @@ window.addEventListener("message", onMessage); function onMessage(e) { + if (!e.ports) return; + output.innerHTML = e.data; // Use the transfered port to post a message back to the main frame e.ports[0].postMessage("Message back from the IFrame");