const { Provider } = ReactRedux; window.addEventListener("message", e => { // extentions and other 3rd party scripts talk via postMeessage api(same orgin) // so it is very important to filter those events if (e.origin !== window.location.origin || !e.data || e.data.source !== "dialog-message") { return; } // parent and window are same thing if the current page is not in any frame if (window !== parent) { parent.postMessage( { messageRecieved: true, source: "dialog-message" }, `${window.location.origin}/iframe-testing-ground` ); } const state = Object.assign({}, e.data); window.redux_store.dispatch(window.redux_actions.loadInitialState(state)); }); window.sendState = () => { window.postMessage(window.redux_store.getState(), `${window.location.origin}`); }; ReactDOM.render( , document.getElementById("root") );