wordpress 拒绝显示.....frame-ancestors https://www.facebook.com

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47736650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 11:18:34  来源:igfitidea点击:

Refused to display..... frame-ancestors https://www.facebook.com

wordpressfacebookfacebook-messengerfacebook-customer-chat

提问by Md. Sahadat Hossain

I have included Facebook customer chat plugin on my website. It works fine for the first day. From the second day, it's not working. I have seen an error message in Google Chrome console:

我在我的网站上包含了 Facebook 客户聊天插件。第一天效果很好。从第二天开始,它不起作用。我在 Google Chrome 控制台中看到了一条错误消息:

Refused to display 'https://www.facebook.com/v2.11/plugins/customerchat.php?app_id=214160985792954&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FlY4eZXm_YWu.js%3Fversion%3D42%23cb%3Df157c0f5ff1898c%26domain%3Dwww.fast-pay.cash%26origin%3Dhttps%253A%252F%252Fwww.fast-pay.cash%252Ff11cff6d515fe88%26relation%3Dparent.parent&container_width=0&locale=en_US&minimized=false&ref=front-page&sdk=joey' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors https://www.facebook.com/"."

拒绝显示 ' https://www.facebook.com/v2.11/plugins/customerchat.php?app_id=214160985792954&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FlY4eZXjs%YWu 3Fversion%3D42%23cb%3Df157c0f5ff1898c%26domain%3Dwww.fast-pay.cash%26origin%3Dhttps%253A%252F%252Fwww.fast-pay.cash%252Ff11cff6d516.parented%3D516fewidth%252Ff11cff6d516fewidth%3D516fewidth%3D516fewidth%3D516fewidth%3D516. page&sdk=joey' 在框架中,因为祖先违反了以下内容安全策略指令:“frame-ancestors https://www.facebook.com/”。

I googled the solution. Every answer I have seen that this is domain white listing problem. But I have whitelisted my domain in facebook page.

我用谷歌搜索了解决方案。我看到的每个答案都是域白名单问题。但我已在 facebook 页面中将我的域列入白名单。

Here is the process how I white listed my domain

这是我如何将我的域列入白名单的过程

  1. First I go to my page settings
  2. Under messenger platform settings I put my domain name for whitelisting
  3. I have put my domain name in several patterns. Here I give you my patterns

    1. https://www.my-domain.com/
    2. https://www.my-domain.com/
    3. https://my-domain.com/
    4. http://www.my-domain.com/
    5. http://my-domain.com/
  1. 首先我去我的页面设置
  2. 在信使平台设置下,我将我的域名列入白名单
  3. 我已经把我的域名放在了几种模式中。在这里我给你我的模式

    1. https://www.my-domain.com/
    2. https://www.my-domain.com/
    3. https://my-domain.com/
    4. http://www.my-domain.com/
    5. http://my-domain.com/

Here is the console error image enter image description here

这是控制台错误图像 enter image description here

采纳答案by Prokash Sarkar

You didn't mention anything about using additional plugins or CMS. Are you using plain PHP or CMS like WordPress? I wonder there might be an issue with your incorrect configuration. Please Re-check your Facebook Page Id. For any additional plugin, make sure to turn it on.

您没有提到有关使用其他插件或 CMS 的任何内容。您使用的是纯 PHP 还是 CMS 之类的 WordPress?我想知道您的配置不正确可能有问题。请重新检查您的 Facebook 主页 ID。对于任何其他插件,请确保将其打开。

回答by Simon East

There are two things required to avoid this message:

避免此消息需要做两件事:

  1. Ensure you have the correct Facebook page ID set in your HTML. This should be the numericID, not what you see in the URL. I found my page's numeric ID via https://findmyfbid.com

    Example:

    <div class="fb-customerchat" page_id="6708927376315932">
    </div>
    
  2. Whitelist your domain at Your Page > Settings > Messenger Platform. Ensure this matches your domain, uses HTTPS protocol, and include the port too if using a non-standard port. (And then make sure you hit the Savebutton!)

  1. 确保您在 HTML 中设置了正确的 Facebook 页面 ID。这应该是数字ID,而不是您在 URL 中看到的。我通过https://findmyfbid.com找到了我的页面的数字 ID

    例子:

    <div class="fb-customerchat" page_id="6708927376315932">
    </div>
    
  2. Your Page > Settings > Messenger Platform中将您的域列入白名单。确保这与您的域匹配,使用 HTTPS 协议,如果使用非标准端口,也包括端口。(然后确保你点击了保存按钮!)

回答by Michael Y.

There are several things:

有几件事:

  1. Ensure Facebook page is Published
  2. Under Facebook page settings (Messenger Platform), add your domain. MUST be https:// Make sure domain name matches exactly including www (or lack thereof).
  3. Use correct app_id
  4. Use this page_id (from steps 3 and 4)
  1. 确保 Facebook 页面已发布
  2. 在 Facebook 页面设置(Messenger 平台)下,添加您的域。必须是 https:// 确保域名完全匹配,包括 www(或缺少 www)。
  3. 使用正确的 app_id
  4. 使用此 page_id(来自第 3 步和第 4 步)

If chat plugin works for you and no one else, it's probably because you're logged into FB and you're the page admin. Check steps 1 & 2.

如果聊天插件对你有用而没有其他人,那可能是因为你登录了 FB 并且你是页面管理员。检查步骤 1 和 2。

回答by bhv

Some of the common things

一些常见的东西

  • whitelist the domain name
  • Facebook page is publicly visible
  • correct page id
  • referrer policy is not set to "no-referrer"

    some other reasons,

  • page not loading through https
  • multiple facebook sdk are added
  • 将域名列入白名单
  • Facebook 页面是公开可见的
  • 正确的页面 ID
  • 推荐人政策未设置为“无推荐人”

    其他一些原因

  • 页面未通过 https 加载
  • 添加了多个 facebook sdk

source, more info

来源,更多信息

回答by Jeff H

Make sure your FB page is published.

确保您的 FB 页面已发布。

回答by Guillermo

I had the same problem. If you click that in the console you'll see it says: Parameter page_id: Invalid id: <107153046051560>

我有同样的问题。如果您在控制台中单击它,您会看到它说:参数 page_id: Invalid id: <107153046051560>

The problem was simply the <>. I removed that so its:

问题只是<>。我删除了它,所以它:

And it worked. Hope it works for you too. Regards

它奏效了。希望它也适用于你。问候

回答by andi79h

I think that's not coming from facebook but your website. Your browser refuses to display an iframe from a "bad" source, in this case facebook.com.

我认为这不是来自 facebook 而是你的网站。您的浏览器拒绝显示来自“坏”来源的 iframe,在本例中为 facebook.com。

You may read

你可以阅读

Or greenlight any requests from facebook like in this example (which is not the best way to do it, as it undercuts some major protection against XSS):

或者像这个例子一样批准来自 facebook 的任何请求(这不是最好的方法,因为它削弱了对 XSS 的一些主要保护):

Link at Stackoverflow: Content-Security-Policy issue

Stackoverflow 上的链接:内容安全策略问题

回答by Jeff Bowen

As evidenced by all these answers, this could be happening for several reasons.

正如所有这些答案所证明的那样,这可能有多种原因。

However, one condition that will lead to this error that I have experienced but have not seen listed here is if you load the page while logged in as a Test User.

但是,如果您在以测试用户身份登录时加载页面,则会导致我遇到但未在此处列出的此错误的一种情况。

回答by gecko

In the "Set Up Customer Chat page" make sure FINISH button is already clicked. If FINISH button is grey, click SAVE button first

在“设置客户聊天页面”中,确保已单击完成按钮。如果FINISH按钮是灰色的,请先点击SAVE按钮

回答by afendio

the issue is not about whitelisting mistake or something else. its about google chrome browser issue. if you open with firefox then there is no problem with the messenger chat. i think it is something wrong with chrome.

问题不在于白名单错误或其他问题。它关于谷歌浏览器浏览器问题。如果你用firefox打开,那么Messenger聊天就没有问题。我认为 chrome 有问题。