2

I have a javascript application that lives on say domainA.com. In order to authenticate a user and set cookies, it opens a popup window on domainB.com. (this is similar to Twitter's @anywhere).

How do detect when the popup on domainB.com closes and call a function in the javascript that opened it on domainA.com?

I've tried various methods like window.opener, window.unload, etc, but run into cross domain limitations.

Caleb
  • 320
  • 2
  • 3
  • 11
  • Possible duplicate of [Can the parent window be notified when a child window closes? (on a diff domain)](http://stackoverflow.com/questions/781770/can-the-parent-window-be-notified-when-a-child-window-closes-on-a-diff-domain) – Simon Lieschke May 25 '16 at 16:40

1 Answers1

0

window.postMessage will help you on browsers that support it... https://developer.mozilla.org/en/DOM/window.postMessage

Mike Ruhlin
  • 3,486
  • 2
  • 20
  • 31