fb:serverfbml won't render on Opera and IE

自作多情 提交于 2019-12-02 04:44:06

I have had the same problem for the whole morning, and I finally solved it! :)

Add:

<div id="fb-root"></div>

...some place inside your body.

Also, add xmlns:fb="http://www.facebook.com/2008/fbml" to the html tag, so that it reads:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

I'm going to post my whole code so that you can compare:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
    <title></title>
</head>


<body style="margin:0px 0px 0px 0px;overflow:hidden;text-align:center;">

    <div id="fb-root"></div>

    <fb:serverFbml>
        <script type="text/fbml">
            <fb:fbml>
                <fb:request-form
                    method="POST"
                    type="jugar a Mahou Liga Chapas"
                    action="http://mahouligachapas.unusualwonder.com"
                    content='¿ Te echas un partido conmigo? 
                        <fb:req-choice url="http://apps.facebook.com/mahouligachapas" label="Sí" />
                        <fb:req-choice url="http://www.facebook.com" label="No" />' 
                >
                    <fb:multi-friend-selector actiontext="Invita a tus amigos a jugar a Mahou Liga Chapas"/>
                </fb:request-form>
            </fb:fbml>
        </script>
    </fb:serverFbml>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://connect.facebook.net/es_ES/all.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            FB.init({ appId: 'XXXXXXXXXXX', status: true, cookie: true, xfbml: true });
        });

    </script>

</body>
</html>

I had same problem. But in may case action parameter of contained " (double quote). When I added slashes problem gone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!