Listen to URL change in the window that opens

If I open a window (with window.open ), can I determine when its URL changes (to a specific one), given that:

  • The source URL of the window is in another domain (more precisely, Facebook)
  • The url I'm interested in finding, too

I need this for authentication. See "Desktop Applications" at the bottom of this page .

+8
javascript facebook cross-domain
source share
2 answers

As long as the new URL is in a domain that is not considered equal to your own using the same origin policy, then this will not be possible.

+2
source share

Well, one of the ways I found is to just continue polling the location.href window (using setTimeout ), but this is hardly elegant.

Refresh . This does not work. I can console.log(newWin.location) just fine, but when I try to access href or hash , I get cross-domain security errors.

0
source share

All Articles