MeltingDog
MeltingDog

Reputation: 15404

Facebook Like Button API - Like different URL to page button is on?

I have a large image gallery web page. I want to have a Facebook 'Like' button per image, so I set the API URL for each like button to be something like:

<div class="fb-like" data-href="http://mysite.com/gallery/photo1.jpg" data-send="true" data-width="300" data-show-faces="false"></div>

However, the Facebook API seems to not like this. The console says there is a mismatch between domains.

I am assuming this is because the actual 'Like' button is on one URL, eg: mysite.com/gallery whilst the URL it is told to like is diffent, eg: mysite.com/gallery/photo1.jpg as once I set them both to the same URL it is fine.

Does anyone know of a work around for this? Have a Facebook Like button on one page, but the page to like on another, separate page?

Upvotes: 2

Views: 1605

Answers (2)

Gil Birman
Gil Birman

Reputation: 35900

Get the link you want to like working in the Facebook debugger and it should work:

http://developers.facebook.com/tools/debug

Update: I don't know if the question changed or I was just zoned out, but you cannot like a JPG file.

Upvotes: 1

Romain Simon
Romain Simon

Reputation: 151

Yes, you can definitively add a like button for a content on another domain.

For the moment, there's a bug on Facebook Like buttons' callbacks, and likes are often not taken into account.

The issue should be solved soon : https://developers.facebook.com/bugs/457950334238629

Upvotes: 1

Related Questions