Facebook Uncaught SecurityError

use*_*610 16 javascript facebook

我目前正在寻找一个Facebook JavaScript应用程序.因此,我只是将文档中的文档粘贴到我的页面中,并且我在控制台中不断收到以下错误:

Uncaught SecurityError: Blocked a frame with origin "http://static.ak.facebook.com" from accessing a frame with origin "http://localhost:8080". Protocols, domains, and ports must match. VM2813:1
Uncaught SecurityError: Blocked a frame with origin "https://s-static.ak.facebook.com" from accessing a frame with origin "http://localhost:8080".  The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
 VM2817:1
Uncaught SecurityError: Blocked a frame with origin "http://static.ak.facebook.com" from accessing a frame with origin "http://localhost:8080". Protocols, domains, and ports must match. 
Run Code Online (Sandbox Code Playgroud)

因此,我然后看起来添加http://localhost:8080到我的Facebook应用程序页面,但我仍然得到相同的错误.在此输入图像描述

这是我正在使用的代码:

<body>

    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : '644205045632878',
          status     : true,
          xfbml      : true
        });
      };

      (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/all.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
    </script>
</body>
Run Code Online (Sandbox Code Playgroud)

请有人解释这里有什么问题.这是我第一次这样做......

小智 60

如果您在看到这些错误消息时使用安装了Ripple仿真器的Chrome进行测试,请尝试禁用Ripple(来自设置,而不仅仅是针对特定页面).显然,即使没有为特定页面启用Ripple,它也会拦截响应并阻碍.

我在Windows 7 Pro 64位上使用Chrome版本34.0.1847.131观察到这一点,并安装并启用了Ripple Emulator(Beta)0.9.15扩展.

  • 如果我只能投票100次 (6认同)