FB.UI Django 应用程序中没有出现对话框

FB.UI dialog is not appearing in the django application

我正在尝试在 Facebook 上分享 post:

<div id="shareBtn" class="btn btn-success clearfix">Share Dialog</div>

<p>The Share Dialog enables you to share links to a person's profile without them having to use Facebook Login. <a href="https://developers.facebook.com/docs/sharing/reference/share-dialog">Read our Share Dialog guide</a> to learn more about how it works.</p>

<script>
document.getElementById('shareBtn').onclick = function() {
  FB.ui({
    display: 'popup',
    method: 'share',
    href: 'https://developers.facebook.com/docs/',
  }, function(response){});
}
</script>

我想知道由于我的应用程序未获得共享对话框而缺少的内容。

这是我发现的控制台错误:

(index):292 Uncaught ReferenceError: FB is not defined
    at HTMLDivElement.document.getElementById.onclick ((index):292)

您必须加载 JavaScript SDK:

window.fbAsyncInit = function() {
    //SDK loaded, initialize it
    FB.init({
        appId      : 'your-app-id',
        xfbml      : true,
        version    : 'v2.10'
    });

    //now FB is available
};

//load the JavaScript SDK
(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.com/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

更多信息: