【问题标题】:How to prevent iframe from processing url's from an outside domain?如何防止 iframe 处理来自外部域的 url?
【发布时间】:2018-01-19 08:52:28
【问题描述】:

我正在做一个项目,我需要限制 iframe 显示我们放入其中的任何 url,而不是原始域。

例如,我的网站是 www.myweb.com。拥有 iframe src="www.yourweb.com" 应该会阻止任何事情继续进行。

我尝试在 Content-Security-Policy 中使用 frame-ancestor 选项。和 X-Frame-Option 到 SAMEORIGIN/DENY。无济于事,没有任何效果。

有什么想法吗?

【问题讨论】:

    标签: c# asp.net security iframe


    【解决方案1】:

    一般来说,Content-Security-Policy: frame-ancestors 'self' 应该可以工作,但这取决于最终用户的浏览器。有关详细信息,请参阅Headers to block iframe loading 并尝试其中描述的两个 HTTP 标头。

    【讨论】:

      【解决方案2】:

      你可以看看-https://developers.facebook.com/docs/messenger-platform/webview/extensions

      特别是

      X-Frame-选项:ALLOW-FROM https://www.messenger.com/ X-Frame-Options: ALLOW-FROM https://www.facebook.com/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-10-26
        • 2010-09-15
        • 2020-04-28
        • 1970-01-01
        • 2018-12-15
        • 1970-01-01
        • 2014-11-21
        相关资源
        最近更新 更多