From f149e115d5eff3c5de61f97f2731bc0ddf58e179 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Thu, 30 Aug 2018 20:26:20 -0700 Subject: [PATCH] prefix postMessage id with carbon: --- pages/embed.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pages/embed.js b/pages/embed.js index 21e602b..4f40b47 100644 --- a/pages/embed.js +++ b/pages/embed.js @@ -61,10 +61,11 @@ class Embed extends React.Component { updateCode = code => { this.setState({ code }) - if (isInIFrame(window)) { - window.parent.window.parent.postMessage( + const iFrame = isInIFrame(window) + if (iFrame) { + iFrame.postMessage( { - id: this.state.id || 'carbon', + id: this.state.id ? `carbon:${this.state.id}` : 'carbon', code }, '*'