开发者

Why wont the facebook stream.share popup work in Safari?

I've been trying to tackle this since last week and for the life of me I cannot seem to get this working on safari, all other browsers render the popup except Safari.

It seems straight forward enough, load up the javascript-sdk asynchronously, initiate it, and call FB.ui with method 'stream.publish'. The thing is I know this code should work in safari cause the example here does http://fbrell.com/fb.ui/stream.share.

I'm using this P3P header which we use that fixes a problem with IE7:

Response.AddHeader("P3P", "CP=\"NON DSP COR DEVa PSAa IVA开发者_高级运维o CONo OUR IND UNI PUR NAV DEM LOC\", " + "policyref=\"http://sweepstakes.mars.com/w3c/p3p.xml\"");

I'm hoping someone could offer the magic tip that's gonna get this working. Here's my code:

<!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:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>
</head>
<body>
    <div id="fb-root">
    </div>
    <script>
        window.fbAsyncInit = function (){

            FB.init({ appId: '<%= Common.appID %>', status: true, cookie: true,
                xfbml: true
            });

            var publish = {
                method: 'stream.publish',
                message: 'test',
                display: 'dialog'
            };

            FB.ui(publish);
        };

        (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>
</body>
</html>


After many tests and frustrations. A colleague pointed out that 'feed' is the new way of doing 'stream.publish'. This fixed the issue.

Edit: Outdated answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜