From 7271ee8495aed15ccc40ece31f99df8967552d97 Mon Sep 17 00:00:00 2001 From: Brian Ressler <137207208+bressler95tops@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:12:16 -0500 Subject: [PATCH] Update index.html --- index.html | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 4663c87..4a5312d 100644 --- a/index.html +++ b/index.html @@ -27,9 +27,13 @@

iFrame Host

function init_iframe() { var iframe = document.createElement('iframe'); iframe.onload = function() { - let receiver = document.getElementById("receiver"); - console.log(receiver); - inject_data(receiver); + + const cookie_value = localStorage.getItem("cookie_value"); + console.log("Attempting to initialize iframe value with local storage: " + cookie_value); + + if(cookie_value != null) { + this.contentWindow.postMessage(cookie_value, '*'); + } }; iframe.src = 'https://iframehost.pages.dev'; @@ -39,15 +43,6 @@

iFrame Host

} init_iframe(); - - function inject_data(receiver) { - const cookie_value = localStorage.getItem("cookie_value"); - console.log("Attempting to initialize iframe value with local storage: " + cookie_value); - - if(cookie_value != null) { - receiver.contentWindow.postMessage(cookie_value, '*'); - } - } });