0

I had a weird experience going on with Window.postmessage(). I had a JS file where i use it for creating an Iframe and insert another JS file. Once that JS file inside the iframe is loaded i'm sending a postMessage to the parent window as the file is loaded. But in few scenarios like with the slow network, listener in the parent window is not getting fired.

I tested adding network throttling in chrome browser i get the same behavior, but if i add a debugger in the JS file that i loaded through iframe it works fine, so i added a setTimeout for postMessage to 1000ms but it doesn't work. Not sure why adding a debugger in the child JS file is working fine. Did any one here went through this issue or any knowledge on why adding a debugger is working.

Appreciate any of your expertise here.

Thankyou

rUI7999
  • 129
  • 1
  • 3
  • 20
  • Possible duplicate of [Problems with window.postMessage on Chrome](https://stackoverflow.com/questions/12641146/problems-with-window-postmessage-on-chrome) – Bilal Siddiqui Oct 15 '19 at 10:57
  • No it’s not a duplicate my issue was in all the browsers and also I wrapped in the set timeout but it doesn’t work, and i also i'm not getting any console errors – rUI7999 Oct 15 '19 at 12:52

0 Answers0