1

I have an iframe with domain abc.com, embedded in a webpage with domain xyz.com. The iframe on click opens a url in new window(window.open() with domain abc.com(same as that of iframe). How can I send a message from the window opened by the iframe to the iframe?

window.opener is empty/null when accessed from the new window.

I know that we can use postMessage(), but window.opener is null. Can someone help me with this?

Localstorage is getting scoped to the popup and not reflecting in the iframes localstorage even though they have the same domain.

avr_dude
  • 242
  • 2
  • 9
  • 1
    Does this answer your question? [Communication between tabs or windows](https://stackoverflow.com/questions/28230845/communication-between-tabs-or-windows) – David Bradshaw Aug 26 '21 at 09:45
  • 2
    @DavidBradshaw my issue started with an iframe on a 3rd party website opening a popup and the popup sets an item in localstorage but its being scoped to the popup and not reflecting in the localstorage where the iframe is embedded. Your link suggests localstorage is the best option which is not working in my scenario. – avr_dude Aug 27 '21 at 05:06

0 Answers0