用于在Firefox中工作的网站的Facebook Messenger,而不是Chrome

时间:2018-03-05 13:42:05

标签: facebook facebook-graph-api nginx facebook-javascript-sdk

这可能是微不足道的,但我试图为网站设置Facebook Messenger,因为它可以通过网页获得。它在Firefox上完全正常加载(如下

fb messenger

在Chrome上加载时,我会遇到以下错误:

Refused to display 'https://www.facebook.com/v2.12/plugins/customerchat.php?app_id=226382507935447&channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FNh1oH0K63yz.js%3Fversion%3D42%23cb%3Df3ee1b33e9fa724%26domain%3Dwww.MYWEBSITE.com%26origin%3Dhttps%253A%252F%252Fwww.MYWEBSITE.com%252Ffa7870694c0fac%26relation%3Dparent.parent&container_width=0&locale=en_US&page_id=1323494501052770&sdk=joey' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors https://www.facebook.com".

我已就此进行了公平的研究,并在白名单中添加/删除我的域名,关闭/修改我的'Content-Security-Policy标题& X-Frame-Options标题,但无济于事。

我目前将X-Frame-Options标头设置为:SAMEORIGIN,将Content-Security-Policy设置为:

default-src 'self'; 
frame-src 'self' https://*.facebook.com https://*.googleapis.com; 
script-src 'self' 'unsafe-inline' 'unsafe-eval' http://cdn.adaptivedigital.io https://*.googleapis.com https://*.gstatic.com https://*.facebook.net https://*.facebook.com *.google-analytics.com https://cdnjs.cloudflare.com; 
style-src 'self' 'unsafe-inline' http://cdn.adaptivedigital.io https://*.googleapis.com; 
img-src 'self' http://cdn.adaptivedigital.io https://*.google-analytics.com https://*.facebook.com https://*.facebook.net https://*.googleapis.com https://*.gstatic.com; 
font-src 'self' http://cdn.adaptivedigital.io https://*.googleapis.com https://*.gstatic.com; 
object-src 'none'

我在最近4个小时内一直坚持这一点,我们将非常感谢任何帮助!

顺便说一下,

Chrome版本:Version 64.0.3282.186 (Official Build) (64-bit)

1 个答案:

答案 0 :(得分:0)

我不相信。事实证明我有以下几套;

add_header Referrer-Policy 'no-referrer';

反过来打破了Facebook messenger插件(仍然很奇怪,它只发生在Chrome 中)。

我最终把它设置为;

add_header Referrer-Policy 'origin';