I'm working on an inter-site single-sign-on project and have had a pretty little problem dropped in my lap. When a user logs out of the "parent" site, a particular page needs to be loaded in the popup window containing the "child" site. However, I can't store a reference to the return value of window.open(…)
, because the user must be allowed to navigate wherever they like on each site before logging out.
This would be easy if I could assume that the child site is always open, as another window.open(…)
to the same named window would change its URL. However, the popup cannot be caused to appear if it isn't already open (not all users have access to the child site).
I think this gives me two conflicting scenarios. When the user visits the child site:
And when the user does not or cannot visit the child site:
So my limitations are:
I was not able to find any relevant resources on Google or SO. Is there a way to accomplish this?
Yes, you can, subject to one important restriction.
It hinges on the following behaviour:
This means that you can get a reference to an existing window, without losing the page that window has open. However, if a window doesn't exist with that name it will be opened.
We used this approach at http://carbonlogic.co.uk/ but because of a Flash Player issue the contents of the popup aren't working properly at the moment
We weren't able to find a way to detect whether the child-site window is still open, but we came up with a workaround which satisfied our business requirements folks:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With