Search code examples
javascriptfacebookfbjs

FB.UI picture not displaying


Everything about this call works, except the picture doesn't display. I found one other question here on SO but with no resolution.

Any idea WHY this doesn't display the picture?. As near as I can tell, FB is eating the picture, because it isn't even showing up in the dialog as an <img> tag, if I mess with the URL it will detect the problem and throw an error message, but why is it eating the image otherwise?

FB.ui({method: 'feed',                                     
       app_id: 'XXXX',
         name: 'This is the name field',
         link: 'http://localhost:8080/facebook/',
      picture: 'http://localhost:8080/img/sample.gif',
      caption: 'This is the caption',
  description: 'Description field'},
       function(response) {
          if (response &amp;&amp; response.post_id) {
                 alert('Post was published.');
          } else {
                 alert('Post was not published.');
          }
       });

Solution

  • Because you place your code in localhost. Facebook do not really know where is your "localhost". Place your code to public hosting, and write ip path or domain name.