This question already has answers here:
Facebook Uncaught SecurityError

(2个答案)


4年前关闭。





我决定将FB登录/共享功能集成到我的网站。但是当我收到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时,我会遇到相同的错误。

我查看了答案herehere,但在我的情况下它们没有起作用。

最佳答案

得到它了。感谢另一个问题:Facebook Uncaught SecurityError

停用Chrome扩展程序中的“涟漪模拟器”。

关于facebook - Facebook与网站的集成-协议(protocol)错误[http/https] ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34474203/

10-14 14:34
查看更多