Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colorbox reload parent page on close

My issue is that I need a colorbox to reload the parent page on close.

This is what I have:

$(".example").colorbox({
    onClosed:function(){
        parent.location.reload();
    }
});

Colorbox loads fine, but doesn't refresh the parent page on close. Any Ideas?

like image 478
Lucas Avatar asked Apr 19 '11 11:04

Lucas


2 Answers

Use window.location.reload(); or window.location = window.location; instead of parent.location.reload();

like image 195
CoolEsh Avatar answered Nov 15 '22 22:11

CoolEsh


A bit delayed, but I've got another answer. You can send the code to reload window from the target page that gets loaded in colorbox.

I was using the colorbox for login/how_it_works/faqs & few other functions. I wanted my parent page to reload only in case of 'login'. So, in response to login form, I sent the following code:

<script type="text/javascript">
 window.parent.location.reload();
</script>

'window' is colorbox window. I'm asking its parent (browser window) to reload.

like image 33
Adway Lele Avatar answered Nov 15 '22 21:11

Adway Lele