Links not showing in Fancybox iframe

天大地大妈咪最大 提交于 2019-12-11 05:42:22

问题


I can't get fancybox to open my links in iframe. My code below. Thanks!

<link href="./fancybox/jquery.fancybox-1.3.4.css" type="text/css" rel="stylesheet"/>
<script src="_js/jquery-1.7.2.min.js"></script>
<script src="fancybox/jquery.fancybox-1.3.4.js"></script>
<script>
$(document).ready(function() {
$('.iframe').fancybox({
'width': '85%', 
'height': '75%',
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
}); // end fancybox
}); // end ready
</script>

And the link I'm trying to open from my page

<a href="http://www.nytimes.com/2010/07/18/books/review/Boyd-t.html" class="iframe">
<div class="linkcontainer"><h1>Review</h1></div></a>

回答1:


There is nothing wrong with your code but the issue has nothing to do with fancybox.

Most probably that page is using X-Frame-Options response header to disallow the page to be opened within an iframe (the case with fancybox, which uses the html iframe tag)

Check this link for further information https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header

Your code will work just fine with any other page from the same domain or not protected against clickJacking though.



来源:https://stackoverflow.com/questions/11278770/links-not-showing-in-fancybox-iframe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!