【问题标题】:Detect an iframe, server side (no javascript)?检测 iframe、服务器端(无 javascript)?
【发布时间】:2015-10-05 21:29:23
【问题描述】:

如何在服务器端检测到我的页面正在 iframe 中加载?

看看这个 HTML 代码 - www.google.com 拒绝加载 iframe。其他页面,例如 www.example.com 会在 iframe 中加载:

 <html>
    <head>
    </head>
    <body>
    <iframe src="https://www.google.com/" width="600" height="300"></iframe>
    </body>
 </html>

他们不使用任何 JavaScript 来检测它,所以我猜一定是服务器端?它是如何制作的?

【问题讨论】:

    标签: html iframe server


    【解决方案1】:

    Google 会发送一个 HTTP 标头 x-frame-options: SAMEORIGIN 以防止显示在 IFrame 中。有关标头的更多信息,请参阅this article

    【讨论】:

      猜你喜欢
      • 2020-05-17
      • 2010-11-13
      • 1970-01-01
      • 1970-01-01
      • 2017-05-19
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      相关资源
      最近更新 更多