链接未显示在Fancybox iframe中 [英] Links not showing in Fancybox iframe
问题描述
我无法通过fancybox在iframe中打开链接.我的代码如下.谢谢!
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>
推荐答案
您的代码没有错,但问题与fancybox无关.
There is nothing wrong with your code but the issue has nothing to do with fancybox.
该页面很可能使用X-Frame-Options response header
禁止在iframe
中打开该页面(fancybox的情况是使用html iframe
标记)
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)
检查此链接以获取更多信息 https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
Check this link for further information https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
您的代码将与相同域中的任何其他页面一起正常工作,或者不会受到clickJacking的保护.
Your code will work just fine with any other page from the same domain or not protected against clickJacking though.
这篇关于链接未显示在Fancybox iframe中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!