Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

close colorbox and redirect parent window to a specific url

I am trying to get colorbox (iframe) to close and for it to redirect the parent window to a specific page that is dynamically depending on the image that is being displayed in the colorbox. So basically each image with have a link next to so the user can click to go to the owner of the image profile.

I have got it so it closes the colorbox but not redirecting the parent window.

<a href='#' onclick='parent.$.colorbox.close(); window.parent.location.href=linkurl;'> owner profile</a>

Any help or pointers would be appreciated. Thanks

like image 294
shuka Avatar asked Nov 18 '25 16:11

shuka


2 Answers

Try this:

<a href="#" id="myLink">click</a>

jQuery('#myLink').click(function(){
  jQuery.colorbox.close();
  window.location.href = 'http://yourlink.com';
});

You could probably remove the window.location and just give youre a tag a link.

like image 63
Michael Avatar answered Nov 20 '25 06:11

Michael


Try to replace window.parent.location.href=linkurl; with opener.location.href=linkurl;

like image 30
Robert Andrea Avatar answered Nov 20 '25 06:11

Robert Andrea



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!