1

我有一个 html 游戏,在游戏完成前最后有一个强制 facebook 分享按钮。

在桌面上一切正常;但是,移动设备会弹出 facebook 对话框,但会一直加载...我需要修改代码还是 facebook 应用程序设置?

[facebook 应用程序设置] 使用 Facebook 登录的网站

[javascript]

shareOnFacebook: function () {
    var that = this;

    FB.login(function(resp) {
        if (resp.authResponse) {
            FB.ui(
            {
                method        : 'feed',
                display       : 'iframe',
                name          : 'game title',
                link          : 'http://www.mylink.com/',
                picture       : 'http://www.mylink.com/gamethumb.jpg',
                description   : 'game description'
            },
        function(response) {
            if (response && response.post_id) {
                // Post was published
                if (ACTIVE) {
                    that.showDrawScreen();                              
                } else {
                    that.showThanksScreen();
                }
            } else {
                // Post was not published
            }
        }
        );
        } else {
        console.log('need to login first');
        }
});

[html]

<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
    FB.init({
      appId                : "xxx",
      status               : true, // check login status
      cookie               : true, // enable cookies to allow the server to access the session
      xfbml                : false,  // parse XFBML
      perms                : 'read_stream',
      frictionlessRequests : true
    });
    };

    // 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 = "http://connect.facebook.net/pt_BR/all.js";
      js.src = "//connect.facebook.net/zh_TW/all.js#xfbml=1&appId=xxx";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script> 
4

0 回答 0