Facebook分享链接(不在移动设备上工作)

时间:2013-11-14 07:43:50

标签: javascript facebook

我有一个html游戏,在游戏结束前有一个强制facebook分享按钮。

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

[facebook app setting] 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> 

0 个答案:

没有答案