我决定将 FB 登录/共享功能集成到我的网站。但是,当我收到 http//https 协议(protocol)错误时,我什至无法使简单的脚本工作:
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时,我得到了同样的错误。 .
最佳答案
明白了。感谢另一个问题:Facebook Uncaught SecurityError
从 Chrome 扩展中禁用“RIPPLE EmULATOR”。
关于Facebook 与网站集成 - 协议(protocol)错误 [http/https],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34474203/