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

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?

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

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.

Related

Facebook Like button not displaying/showing in any browser

We are having an issue with the Facebook like button not showing/displaying, on this page:
http://powertextblog.esvelte.net/
It appears that the span and iframe that are generated have an inline style of width:0px and height:0px , I have tried overriding this to no avail.
The button is not showing in any browser.
This is the code we're using on the page (from AddThis) to generate the button.
<a class="addthis_button_facebook_like" fb:like:layout="button_count" addthis:url="http://www.facebook.com/PowerText"></a>
I also tried inserting the Facebook like button using Facebook's own button generator, but the same problem occurs (which would indicate its not an AddThis issue)
Any help would be appreciated.
I had the same problem, tried everything until I figured out that was something really stupid.
If your facebook page has any restriction, like Country restrictions or Age restrictions, facebook does not show the like button if you are not logged in.
I think it is a Facebook bug causing the issue.
Removing the defined URL addthis:url="http://www.facebook.com/PowerText" and using the site domain instead, fixed the issue.
So I think there is some sort of FB bug where defining the URL as a Facebook page causes it to not display, as it works fine without it.
Try this facebook like code it should be work.
<a class="addthis_button_facebook_like" fb:like:layout="button_count" fb:like:action="recommend" fb:like:width="135"></a>
Had the same problem yesterday. I then played around with the widget on https://developers.facebook.com/docs/plugins/like-button a while. Turned out this only happened with Facebook Page URLs (the URL to like). Even https://facebook.com/facebook itself didn't work correctly anymore. Simply rendered with 0px. All other URL worked as expected. Tried to reach FB on Twitter and they sent this link to the filed issue. Which says bug is known and fixed now.
So we simply had to wait. After one night the next morning all Like buttons with Facebook Page URLs rendered correctly again.

Like button doesn't work with any Facebook Page

Apparently, something happened with facebook that i cannot like any Facebook page (in ex. http://www.facebook.com/TheSimpsons).
You can like such page on a page itself but not via Like button on your website.
Even on facebook documentation page (http://developers.facebook.com/docs/reference/plugins/like/) if you put this url and try to click generated button, it will like and immediately unlike it.
Are there any known reason for such behavior or workaround?
This was Facebook bug which is closed now

Populate a sharer link for facebook

Im using this URL to share my website without having to add any facebook code:
http://www.facebook.com/sharer/sharer.php?u=http://yahoo.com
And I was wondering, is there any way to populate the description field, like another URL parameter?
EDIT: Seems like sharer its deprecated in favour of the like button, but i dont want to use the ugly look of the like button. is there a way to replace it? Im trying to achieve an effect like this in twitter:
<a href='http://twitter.com/home?status=My_message' <img src='mytwittericon.png' /></a>"
The facebook "sharer" has been deprecated and is no longer supported as it states here:
The Share button has been deprecated in favor of the Like button, and
will no longer be supported. Please use the Like button whenever
possible to drive maximum traffic to your apps.
And here:
What happened to the old Share button?
We deprecated the Share Button when we launched the Like button,
because the Like button improves clickthrough rates by allowing users
to connect with one click, and by allowing them to see which of their
friends have already connected.
I actually find Sharer more useful than Like button.
Try this code:
<img src="http://yourdefaultsharebutton.png">
Or just set proper OG tags.

Need Advice: Facebook Like Button to like a subsite

i'm struggling around for days now ...this is the scenario:
a user can upload a pic and add some text on the site. After that, he/she gets a link that leads to his created content. I want the user not only to share his content with the link, but also on facebook with specified image and text. Tried this with open graph tags, but it is bad changing those tags dynamicly before liking because fb caches that info and does not recognize specific changes ... but correct me if i'm wrong ...
The problem seems to be, that when the user clicks on the like button, the content to share is not the actual site, but the subsite with its content ...
How would you do this?
Thanks for any advice!
I think you are looking for something like this:
facebook like: href url vs. canonical url
doing it with the fbjs sdk was the right hint ... now it works perfektly and individual ...

Liking a Specific Facebook Post

I'm trying to embed the Facebook Like button on a web site. The URL of the item I am trying to allow the user to "like" is an individual Facebook post on a Page's wall.
I'm using a simple FBML implementation of the Like button like so:
<fb:like href="http://www.facebook.com/[PAGENAME]?v=wall&story_fbid=[ID OF THE POST]" layout="button_count"></fb:like>
The like button works, but when it is clicked, the user is actually liking the PAGE, not the individual post.
Any help would be much appreciated. I've tried various formats for the URL, but so far have not been able to make it work.
Thanks!
What you are trying to do is not possible. You can only 'like' things that have a unique page to display them. The url you have ?v=wall&story_fbid=[ID OF THE POST] is just a 'helper' url for facebook. It takes you to the http://www.facebook.com/[PAGENAME] url and Facebook will treat this url the same as the page.
It is a bit confusing because you could do something like you are talking about off of facebook, but the like inside of Facebook isn't really the same as what the like button's are doing. The like buttons are using the Open Graph protocol. Content on facebook.com doesn't play by the same rules.
In short, likes for "facebook generated" content inside of facebook can only be liked inside of facebook.
Check out this article for more information on some of the things you can do with the like button inside facebook: http://developers.facebook.com/blog/post/407
Very late answer, but the Graph API might help. You might be able to grab a post and like it - https://developers.facebook.com/docs/reference/api/post/