最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - close colorbox and redirect parent window to a specific url - Stack Overflow

programmeradmin0浏览0评论

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

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

Share Improve this question asked Sep 11, 2013 at 20:39 shukashuka 1352 silver badges8 bronze badges 2
  • There are like hundreds of questions about redirecting from iframe (think we get one every day), just use the search feature next time, please... – UIlrvnd Commented Sep 11, 2013 at 20:42
  • thanks Stefan, yes I have just spend a couple of hours going through them and could not find one that was using a link, as most are using forms – shuka Commented Sep 11, 2013 at 20:49
Add a ment  | 

2 Answers 2

Reset to default 6

Try this:

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

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

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

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

发布评论

评论列表(0)

  1. 暂无评论