diff --git a/channel-messaging-multimessage/page2.html b/channel-messaging-multimessage/page2.html index fdd61e15..5ed9a6f9 100644 --- a/channel-messaging-multimessage/page2.html +++ b/channel-messaging-multimessage/page2.html @@ -24,8 +24,10 @@ // Setup the transfered port function initPort(e) { - port2 = e.ports[0]; - port2.onmessage = onMessage; + if (e.ports[0]) { + port2 = e.ports[0]; + port2.onmessage = onMessage; + } } // Handle messages received on port2