Today, I was trying to implement SSO in an application where API is returning the authentication details. I needed to open a Window with a URL for SSO because that can’t be open in iframe and our application was in iframe. Whenever the work was completed by the window then we needed to post a message, and the listener for that message was registered in the parent window which opened the other window. So to post message to the parent window (because event was registered there) we needed to access the parent window. So to access the parent window we have to use window object and its property opener to access parent window. This way we can access parent window as well. If I needed, I could close the parent window from the child window as well.

Summary

  • Window.opener property is used to access parent window.
  • After accessing parent window you can use all properties and methods that can be used with any window.

0 Comments

Leave a Reply

Avatar placeholder