JQuery ColorBox, iframe to parent

Associate
Joined
16 Jul 2008
Posts
271
Location
London
Hi,

I have a login screen, that overlays my main home page as an iframe. I need the following to happen, once a user enters the correct login details, the iframe should close and redirect them to the account page.

My homepage is setup with this code:
PHP:
$(".login").colorbox({transition:"none", width:"60%", height:"80%", iframe:true});

The iframe page is using thise code:
PHP:
<a href='accounts.php' onclick='window.parent.$.colorbox({href:"accounts.php"}); return false;'>Open from parent</a>

This closes the iframe but opens another iframe, so I must be missing some small detail.

Any help be great.

Thanks
 
After trying a number of things, turns out it was such a simple solution afer all

Doesn't even require any JavaScript, just set the target to top
Code:
<a href="whateverepage.html" target="_top">

or JavaScript method
Code:
onclick='parent.document.location.href = "whateverpage.html"
 
I did similar things for a site I made a while ago. The difficulties of communicating between an iframe and its parent came close to driving me mad. Were I doing it again, I'd probably just use jQuery to append an absolutely-positioned pop-up to the current page instead.
 
Back
Top Bottom