Facebook JavaScript SDK: stream.publish in $.post on a mobile device


August 13, 2012 at 08:43
Facebook

This works on  iOs / Android:
    var obj = {
        method: 'stream.publish',
        link: 'http://www.test.de',
        picture: picture,
        name: 'Dies ist ein Wallpost!',
        caption: 'Der Wallpost Untertitel',
        description: 'Jahaaa, die Description lorem ipsum dolor sit amet... ',
        action_links: [{ text: 'Bäm!', href: 'http://www.test.de' }]
    };    
    FB.ui(obj);
This doesn't:
    $.post('somelink.php', {id: id}, function(text){
         var obj = {
            method: 'stream.publish',
            link: 'http://www.test.de',
            picture: picture,
            name: 'Dies ist ein Wallpost!',
            caption: 'Der Wallpost Untertitel',
            description: 'Jahaaa, die Description lorem ipsum dolor sit amet... ',
            action_links: [{ text: 'Bäm!', href: 'http://www.test.de' }]
        };    
        FB.ui(obj);        
    });
My solution is not to use the javascript SDK at all:
$app_id = '4444444444444';
$redirect = 'http://www.xxx.xx/somelink.php';
$link = 'http://www.test.de';
$message = 'Dies+ist+ein+Wallpost!';
$caption = 'aaaa';
$desc = 'bbbbbbb';
$name = 'cccc';
$url= "https://www.facebook.com/dialog/feed?app_id=".$app_id."&redirect_uri=".$redirect."&link=".$link."&message=".$message."&picture=".$picture."&caption=".$caption."&description=".$desc."&name=".$name;
header("Location:".$url);

Hinterlasse einen Kommentar:
Search