Adds code to catch popup close on cross domain urls.