I am working on a web application project. The project consists of normal php web pages and an embedded react app. I have developed all the web pages and outsourced the react app section.
I have put the react app in an iframe.
• I want to delay the react app from uploading until everything on my web page is loaded.
This is because I am sending information in to the app via iframe.contentWindow.postMessage()
. And I am using an eventlistener to get the information.
The problem I am experiencing is that react is loaded before the event is triggered. So my react act keeps reading an undefined source. So I want to delay it from loading until after either the web page is loaded or after the event is triggered.
• I cannot block the iframe from loading cause the iframe.contentWindow.postMessage()
posts the information to the iframe on load.
Can anyone show me how to delay the react app from loading until the post message is sent?
Thanks in advance guys