0

我创建了一个 share_facebook 函数。当用户点击按钮时,它会提示他们登录 facebook 并分享我们的网站。但是,在共享对话框中,右侧有一个无法消除的空白。我正在使用 facebook 推荐的图像大小 1200x630px。这里有人可以帮忙吗?

Facebook 分享对话框的屏幕截图

    (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'));

      window.fbAsyncInit = function () {
        var appId = '1746827655661251';
        FB.init({
          appId: appId,
          xfbml: true,
          version: 'v2.9'
        });
      };

      function share_facebook()
      {
        event.preventDefault();
        event.stopPropagation();
        event.stopImmediatePropagation();

        // Dynamically gather and set the FB share data. 
        var FBDesc      = 'Water and Sump Pump Backup is an endorsement to the Homeowners Policy that is often forgot about by first time home buyers. A homeowners insurance policy in its standard form will not cover water that is “backed up” through a drain, toilet, etc';
        var FBTitle     = 'Welcome to my site';
        var FBLink      = 'https://www.mygreatsite.com/';
        var FBPic       = 'https://www.mygreatsite.com/images/home_feature2.jpg';

        // Open FB share popup d
        FB.ui({
            method: 'share_open_graph',
            action_type: 'og.shares',
            action_properties: JSON.stringify({
                object: {
                    'og:url': FBLink,
                    'og:title': FBTitle,
                    'og:description': FBDesc,
                    'og:image': FBPic
                }
            })
        },
        function(response)
        {
          //response codes
        });
       }
4

1 回答 1

0

找到解决方案 - 我没有使用“share_open_graph”方法,而是使用“share”。

于 2017-11-07T14:55:31.973 回答