Fancybox iframe 为空白

发布于 2025-01-07 11:35:25 字数 256 浏览 4 评论 0原文

所以我已经下载了 fancybox zip 并将其添加到我的网站。当我进入演示区时,除了 iframe 之外,一切都工作正常。无论如何我还没有编辑过代码。它在他们的网站上运行得很好,所以我不确定为什么在我的网站上会有所不同。我已经搜索过这个网站和其他网站,但一无所获。同样,我没有编辑任何代码,我只是将其解压缩并将其推送到我的服务器。有什么想法吗? 在此处查看

so i have downloaded the fancybox zip and added it to my site. when i go to the demos area, everything is working fine with the exception of the iframe. i havent edited the code in anyway. it works perfectly on their site, so im not sure why it would be any different on mine. i have searched through this site and others and have came up with nothing. again i have not edited any of the code, i simply unzipped it and pushed it to my server. any ideas? View Here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绝影如岚 2025-01-14 11:35:25

这不是一个 fancybox 问题。

fancybox 下载中包含的演示文件针对 iframe 示例的 jQuery 站点......但如今大多数主要站点(例如 google), yahoo 和其他公司等(现在还有 jQuery)不允许将自己包含在 iframe 中。我猜演示文件已经过时了。

如果您可以将任何网站放置在常规 html iframe 中(例如您自己的或您创建的任何其他网站),那么您也可以使用 fancybox 打开它。 查看此演示并亲自查看 ...注意哪些 iframe 是“空白” 。

您还可以查看此帖子以供参考。

This is not a fancybox issue.

The demo file included in the fancybox download, targets the jQuery site for the iframe sample .... but today most mayor sites like google, yahoo, and others etc. (and now jQuery too) don't allow themselves to be contained within iframes. I guess the demo file is outdated.

If you can place any web site within a regular html iframe (like your own or any other you create for instance), then you can open it with fancybox too. Check this demo and see it for yourself ... notice what iframes are "blank".

You can also check this thread for reference.

伊面 2025-01-14 11:35:25

调试时需要使用浏览器的错误日志/控制台。

我明白了

拒绝显示文档,因为 X-Frame-Options 禁止显示。

单击Iframe链接时。

jquery.com 显然正在实施 X-Frame-Options 响应标头来阻止您在 iFrame 中加载他们的网站。

更新

这是从 jquery.com 返回的标头的摘录

$ telnet jquery.com 80
Trying 70.32.73.125...
Connected to jquery.com.
Escape character is '^]'.
GET / HTTP/1.1
Host: jquery.com

HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN

You need to use your browser's error log / console when debugging.

I get

Refused to display document because display forbidden by X-Frame-Options.

when clicking the Iframe link.

jquery.com is obviously implementing the X-Frame-Options response header to prevent you loading their site in an iFrame.

Update

Here's an extract of the headers returned from jquery.com

$ telnet jquery.com 80
Trying 70.32.73.125...
Connected to jquery.com.
Escape character is '^]'.
GET / HTTP/1.1
Host: jquery.com

HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
土豪我们做朋友吧 2025-01-14 11:35:25

很简单,Iframe 没有有效的来源。

iframe 有一个名为 src(源)的属性,它是要在内联框架中显示的站点的地址;您在该演示中的链接链接到 http://jquery.com
我不知道 Fancy box 是如何工作的,但我敢说那不是你想要的!

<iframe class="fancybox-iframe" name="fancybox-frame1329790605687" frameborder="0" hspace="0" scrolling="auto" src="http://jquery.com"></iframe>

fancybox 主要演示站点上的 src 属性链接到本地​​页面:

<iframe class="fancybox-iframe" name="fancybox-frame1329790726739" frameborder="0" hspace="0" scrolling="auto" src="/demo/iframe.html"></iframe>

您可以在 iframe 之外看到该页面:

http://fancyapps.com/demo/iframe.html

Very simply, the Iframe doesn't have a valid source.

Iframe has an attribute called src (source) which is the address of the site you want to display in the inline frame; yours in that demo is linking to http://jquery.com
I don't know how Fancy box works but I daresay that isn't what you wanted!

<iframe class="fancybox-iframe" name="fancybox-frame1329790605687" frameborder="0" hspace="0" scrolling="auto" src="http://jquery.com"></iframe>

The src attribute on the main fancybox demo site links to a local page:

<iframe class="fancybox-iframe" name="fancybox-frame1329790726739" frameborder="0" hspace="0" scrolling="auto" src="/demo/iframe.html"></iframe>

Which you can see here outside of the iframe:

http://fancyapps.com/demo/iframe.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文