【问题标题】:Refused to display in a frame拒绝在框架中显示
【发布时间】:2018-02-15 10:11:23
【问题描述】:

我正在使用 iframe 在其上显示日历。但我不断收到以下信息;

拒绝在框架中显示“https://cal.mixmax.com/user1”,因为 祖先违反了以下内容安全策略指令: “框架祖先'自我'https://mail.google.com https://inbox.google.com https://.force.com https://.mixmax.com"。

我尝试将 Content-Security-Policy 的元数据设置为如下,但没有成功。

<meta http-equiv="Content-Security-Policy" 
      content="frame-ancestors 'self' 
      https://mail.google.com 
      https://inbox.google.com 
      https://*.force.com 
      https://*.mixmax.com">

知道如何克服它吗?

【问题讨论】:

    标签: iframe content-security-policy


    【解决方案1】:

    问题不在于您的配置错误,而在于 Mixmax 方面的 CSP 指令。他们的页面上有以下指令:

    content-security-policy:
      frame-ancestors 'self'
      https://mail.google.com
      https://inbox.google.com
      https://*.force.com
      https://*.mixmax.com;;
    frame-src:
      https://*.stripe.com
      https://*.facebook.com
      https://*.mixmax.com;;
    

    因此,除非您来自任何列出的域,否则您不能对其进行框架化。

    克服这个问题的一种方法是在您的站点上创建一个代理,代表客户端访问 MixMax,并将数据发送到您的框架,因为 CSP 仅由客户端强制执行。

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 1970-01-01
      • 2015-03-15
      • 2021-06-15
      • 2020-11-10
      • 2019-03-09
      • 2022-07-18
      • 1970-01-01
      • 2020-05-21
      相关资源
      最近更新 更多