iFrame不加载URL [英] iFrame not loading URL
问题描述
我正在使用以下简单的iFrame代码来加载Yahoo,但它不会加载。在Chrome Inspector中,我首先看到URL状态为301,然后取消。任何想法为什么会发生这种情况?
< iframe name =iframe1src =http://yahoo.com >< / iframe中>
您可能会在日志中看到一条错误消息,像这样:
拒绝显示文档,因为X-Frame-Options禁止显示。
回答您的问题: $ b 雅虎通过确保避免点击劫持攻击它们的内容并未嵌入到其他网站中。
更多信息请阅读:
https://developer.mozilla.org/zh/The_X-FRAME-OPTIONS_response_header
I am using the following simple iFrame code to load Yahoo but it's not loading anyway. in Chrome Inspector I see the URL status as 301 first and then cancel. Any idea why is it happening?
<iframe name="iframe1" src="http://yahoo.com"></iframe>
You probably get an error message in the log that reads something like this:
"Refused to display document because display forbidden by X-Frame-Options."
To answer your question:
Yahoo is doing this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.
For more info read this: https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
这篇关于iFrame不加载URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!