简体   繁体   中英

Facebook "GET https://connect.facebook.net/en_US/sdk.js" giving ERR_INSECURE_RESPONSE

I tried the sample code which was provided by Facebook at Quickstart guide and I am geting the following response:

GET https://connect.facebook.net/en_US/sdk.js net::ERR_INSECURE_RESPONSE

The following is my source code:

    <!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>FBTestDrive</title>
</head>
<body>
    <script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'I got the app id.',
      xfbml      : true,
      version    : 'v2.9'
    });
    FB.AppEvents.logPageView();
  };

  (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";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));

</script>
</body>
</html>

I've tried putting http/https before //connect.facebook.net/en_US/sdk.js and I am also running the application from a server (local Apache Tomcat web server) but nothing is working.

I don't have enough reputation to comment so posting as an answer. Did you change the appId? most common mistake is to use the placeholder.

In case someone else finds this question:

I have seen this error appear when IT departments are blocking access to Facebook. The request to connect.facebook.net (or any facebook.net or facebook.com address) will be intercepted by the corporate proxy, and a 403 Forbidden response will be returned instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM