Facebook javascript api and ipad, android

I am trying to use the FB.login method from the javascript SDK framework. Everything is fine on desktop browsers. But I have a problem with iPad and Android (motorola xoom).

unable to post message to recipient has origin www.facebook.com

How can it be resolved?

I am trying to post to a user’s wall

FB.login(function(response) {
           if (response.authResponse) {
             log("Info: login successfully");
             fbPublish();
           } else {
             log('User cancelled login or did not fully authorize.');
           }
         });

and when in fbPublish

function fbPublish(){
        log("Debug: fbPublish");
        FB.ui({
          method: "stream.publish",
          attachment: {
             name: uatitle.format(myChoice.question, myChoice.answer),
             href: document.location.href,
             media:[{"type":"image","src":"http:.....","href":document.location.href}]
          },
          action_links: [{ text: 'Vote yourself', href: document.location.href }]
         },
         function(response) {
           if (response && response.post_id) {
             log('Post was published.');
           } else {
             log('Post was not published.');
           }
         }
        );
    }

therefore, as I said on the desktop, everything is fine / a new message was published successfully. but I have a bug on mobile devices

+3
source share
1 answer

You should probably opt out of stream.publish asap as it will be history and start using the api chart for publishing.

The post looks something like this:

var params = {};
params['message'] = 'Message';
params['name'] = 'Name';
params['description'] = 'Description';
params['link'] = 'http://apps.facebook.com/my-app/';
params['picture'] = 'my-site';
params['caption'] = 'Caption';

FB.api('/me/feed', 'post', params, function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Published to stream !');
  }
});

hope this helps

0
source

All Articles