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

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);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.