38

Here's my FB.ui code:

FB.ui({ 
  method: 'feed', 
  message: '', 
  link: 'http://mywebaddress/pathToContent', 
  picture: 'http://mywebaddress/pathToPhoto/photo.jpg', 
  display: 'popup'
});

The dialog pops up perfectly, it has the link so no problem... but the picture doesn't show.

I have verified the picture URL is correct. Then I have used the Debugger to test the content URL's open graph tags: it runs flawlessly.

Apparently, the debugger clears some sort of caching. After I use the debugger on the link, the FB.ui dialog shows the picture just fine.

Is there something I can do about this? The content that users are sharing from my site to Facebook isn't showing the picture like it should, making it a bit annoying for them to use (which is never a good thing!)

Thanks!

4
  • 1
    You are saying that using the debugger solves the problem? so it's a caching issue...
    – ifaour
    Commented Oct 15, 2011 at 10:01
  • OK, so the url "graph stuff" is being cached without a photo even though from inception the page has had a valid og:image tag? And, the FB.ui code, even when provided a picture attribute, ignores it and instead uses the no photo cache? If it's a caching issue, sounds like it would be on Fb's side, how to get around it?
    – Chaddeus
    Commented Oct 15, 2011 at 12:32
  • Have you tried submitting the FB.ui dialog? even if the image is not shown there...is it shown when you publish? if so, then I would assume there's something wrong in the dialog
    – ifaour
    Commented Oct 15, 2011 at 13:38
  • I have tried submitting it... I just updated my code, to make the picture attribute url slightly different than what the og:image tag has... I added ?v=1 to the path, after the picture's file extension. So far, this has made it better... but still testing. Thanks for the responses.
    – Chaddeus
    Commented Oct 15, 2011 at 15:43

2 Answers 2

0

You need to change the og:image in the source of the shared url instead. The picture parameter is deprecated: https://developers.facebook.com/docs/sharing/reference/feed-dialog/#response

-2

The problem is that you didn't set the URL of your image.

Since you're using a relative URL, the FB.ui is looking for the image in the same folder as the current page. What you should do is put the full URL of your image.

<code>picture: 'http://mywebaddress/pathToPhoto/photo.jpg',</code>
If you don't have the full URL of your image, you can use the following code to get the full URL:
<code>var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
url = url.substring(0, url.lastIndexOf('/') + 1);
url += 'pathToPhoto/photo.jpg';
</code>

Not the answer you're looking for? Browse other questions tagged or ask your own question.