Facebook 与网站集成 - 协议错误 [http/https]
Facebook integration with website - protocol error [http/https]
我决定将 FB login/sharing 功能集成到我的网站中。但是,当我收到 http//https 协议错误时,即使是简单的脚本也无法正常工作:
Uncaught SecurityError: Blocked a frame with origin "https://staticxx.facebook.com" from accessing a frame with origin "http://www.my-site.com". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
我从FB docs复制粘贴的代码是:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=505598882820893";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
事实上,当我 运行 登录 script 时,我得到了同样的错误。
我查看了答案 here and here,但它们对我没有用。
知道了。感谢另一个问题:Facebook Uncaught SecurityError
从 chrome 个扩展中禁用 'RIPPLE EMULATOR'。
我决定将 FB login/sharing 功能集成到我的网站中。但是,当我收到 http//https 协议错误时,即使是简单的脚本也无法正常工作:
Uncaught SecurityError: Blocked a frame with origin "https://staticxx.facebook.com" from accessing a frame with origin "http://www.my-site.com". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
我从FB docs复制粘贴的代码是:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=505598882820893";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
事实上,当我 运行 登录 script 时,我得到了同样的错误。
我查看了答案 here and here,但它们对我没有用。
知道了。感谢另一个问题:Facebook Uncaught SecurityError
从 chrome 个扩展中禁用 'RIPPLE EMULATOR'。