没有使用Facebook的有效版本调用init

时间:2018-12-16 00:42:24

标签: javascript facebook facebook-javascript-sdk

我使用来自Facebook的代码供开发人员建立登录名,然后尝试使用其上的代码注销。出现错误。然后,我找到了解决该问题的解决方案,最后进入下面的问题。我是Java语言的新手,请给我一些详细的帮助。非常感谢! init not called with valid version

<html>
<head>
    <title>User</title>
</head>
<script>

    window.fbAsyncInit = function() {
    FB.init({
      appId      : '**************',
      cookie     : true,  // enable cookies to allow the server to access
                          // the session
      xfbml      : true,  // parse social plugins on this page
      version    : 'v3.2' // use graph api version 2.8
    });

    // Additional initialization code here
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  };

  // Load the SDK Asynchronously
  (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 = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));


    function logout() {
        FB.logout(function (response) {
            // user is now logged out
        });
    }


</script>

<body>

<div class='container'>

        <div class="row">
            <div class="col-2">
                <button class="btn btn-lg btn-primary btn-block" onclick="logout();">log out</button>
            </div>
        </div>

    </form>
</div>
</body>

</html>

0 个答案:

没有答案