【问题标题】:How can I make my website not be displayed in iframes [duplicate]如何使我的网站不在 iframe 中显示 [重复] 【发布时间】:2012-07-30 15:30:40 【问题描述】: 可能重复:How to Block Iframe call 我希望我的网站不在 iframe 中显示。 我该怎么做? 【问题讨论】: 请提供一些示例代码来说明您目前正在做什么。 stackoverflow.com/questions/5881139/how-to-block-iframe-call 标签: php html .htaccess 【解决方案1】: 将此添加到您的 htaccess 或服务器配置中: Header always append X-Frame-Options SAMEORIGIN 它将阻止(至少在支持它的浏览器中)您的网站显示在另一个网站的 iFrame 中。 【讨论】: 这是我从来没有遇到过也没有想过要实现的。我猜你每天都会学到一些新东西! @Matt 如果你今天学到了一些东西,最好投反对票? @HasanKhan 说得好,先生。在这篇文章中 +1!