How to close Shadowbox automatically

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to close Shadowbox automatically

manelgarcia
Hi, i'm making a login script using this magnifical shadowbox, but i've got a question:

Once, the user is logged in i want to close automatically the shadowbox, i've tried to use Shadowbox.close(); on the looged page but it doesn't works.

Can someone help me?

Thanks !
Reply | Threaded
Open this post in threaded view
|

Re: How to close Shadowbox automatically

sangraal
Try parent.Shadowbox.close() if you're calling it from the page loaded within Shadowbox.
Reply | Threaded
Open this post in threaded view
|

Re: How to close Shadowbox automatically

bargizey
In reply to this post by manelgarcia
Hi,

I faced and solved the same problem. I am coding a .NET code. It has a login page. After successfull login i am redirecting the page to itself with a querystring parameter. After that I am registering a client script as follows:

                if (Request.QueryString["LoggedIn"] != null)
                {
                        if (!cs.IsStartupScriptRegistered(cstype, "CloseBox"))
                        {
                                Type cstype = this.GetType();
                                ClientScriptManager cs = Page.ClientScript;
                                String cstext = "parent.Shadowbox.close();";
                                cs.RegisterStartupScript(cstype, "CloseBox", cstext, true);
                        }
                }
Reply | Threaded
Open this post in threaded view
|

Re: How to close Shadowbox automatically

bargizey
Fixed code :)

                if (Request.QueryString["lgdin"] != null)
                {
                        ClientScriptManager cs = Page.ClientScript;
                        Type cstype = this.GetType();
                        String cstext = "parent.Shadowbox.close();";

                        if (!cs.IsStartupScriptRegistered(cstype, "CloseBox"))
                        {
                                cs.RegisterStartupScript(cstype, "CloseBox", cstext, true);
                        }
                }
Reply | Threaded
Open this post in threaded view
|

Re: How to close Shadowbox automatically

mi5ha
In reply to this post by sangraal
Both solutions use parent object ... but when I try to use it I get:

Error: uncaught exception: Permission denied to get property Window.Shadowbox

I'm not sure how .NET solution can work cause even in that case browser restrictions are in effect?

But I just realized that one should only reload the same page in parent in order to remove Shadowbox!

parent.location.href = parent.location.href