Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Uncaught SecurityError

I'm currently looking to make a Facebook JavaScript App. As such I'm literally just copy pasting out of the docs into my page and I keep getting the following errors in the console:

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. 

As such I then looked to add http://localhost:8080 to my Facebook app page and yet I'm still getting the same error.enter image description here

Here is the code I'm using:

<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>

Please can someone explain what is wrong here. This is my first time doing this...

like image 500
user481610 Avatar asked Mar 12 '14 19:03

user481610


1 Answers

If you are testing with Chrome with the Ripple emulator installed when you see these error messages, try disabling Ripple (from settings, not just for the particular page). Evidently even when Ripple isn't enabled for a particular page, it intercepts the response and gets in the way.

I observed this with Chrome version 34.0.1847.131 on Windows 7 Pro 64-bit with the Ripple Emulator (Beta) 0.9.15 extension installed and enabled.

like image 186
peterr Avatar answered Oct 25 '22 16:10

peterr