FB.ui 网络和移动 phone

FB.ui for both web and Mobile phone

我正在制作一个具有 Facebook 共享功能的 html5 响应式网页。

我已经为 FB.ui 创建了这个 javascript 代码:

    <script>
        window.fbAsyncInit = function () {
            FB.init({appId: 'appid', status: true, cookie: true,
                xfbml: true});
        };
        (function () {
            var e = document.createElement('script');
            e.async = true;
            e.src = document.location.protocol +
                    '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
        }());
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#fb-share-button').click(function (e) {
                e.preventDefault();
                FB.ui(
                        {
                            method: 'feed',
                            name: 'title',
                            link: ' http://linkToShare.com',
                            picture: 'http://helloImage.png',
                            caption: 'Caption Best',
                            description: 'Desc',
                            message: '',
                            display: 'touch'
                        });
            });
        });
    </script>

如果是移动 phone 浏览器,我希望 "display" 属性获得值 'touch',如果是桌面浏览器,则获得 'dialog' 值。

我试着总是把它放在 'dialog' 但它在 Android 上的 Firefox 上有奇怪的显示问题。

谢谢;

经过对桌面和移动设备浏览器的测试,最适合显示 FB.ui 的参数是

display: 'iframe'

已测试并 100% 正常工作