Can anybody tell how is it possible to create a facebook like button with the option to add a message? example can be found here http://www.familycircle.com/style/beauty/hair/summer-hairstyles/
If user does not write anything as a message, the button behaves like normal like button. If user writes a message, it will appear on his/her wall. Thank you.
As Facebook says:
When will users have the option to add a comment to the like?
If you are using the XFBML version of the Like button, users will always have the option to add a comment. If you are using the iframe version of the button, users will have the option to comment if you are using the standard layout. If users do add a comment, the story published back to Facebook is given more prominence.
Like Button
that's the normal behavior of facebook's like button. You have the option of writing a comment or message, and here's how I do it, with HTML5
put this after the body tag
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=YOURAPPID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
put this where you want to see the button
<div class="fb-like" data-href="http://someurl.com" data-send="true" data-width="450" data-show-faces="true"></div>
Or create yours here
Related
I created a Facebook share widget on my page. When I use the widget to share the page to my own Facebook account, I find that the box that gets created on my timeline contains a link "WIDGET_LIKE_LOG_APP".
When I click that link, it takes me to a page
https://www.facebook.com/games/?app_id=107599262613689
with the error message :
Sorry, WIDGET_LIKE_LOG_APP hasn't been approved for display in App
Center.
How can I prevent Facebook from creating that WIDGET_LIKE_LOG_APP link?
Code on my page to create the share widget:
<div id="fb-root"></div>
<script type="text/javascript">
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-href="#Model.Url" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>
Looking at your code it seems you are using the Like Button instead of the Share Button.
Anyway the problem is that you are not specifying an appId on the widget definition (on the js.src parameter). You can use the wizard on the Like Button page to get the specific code that you should embed in your page.
I reported this issue to Facebook. They confirmed this was a bug. They've now come back to me saying the bug has been fixed.
I've some trouble with the Like Button. I would like to like a specific post like this one from a external website but it doesn't work:
https://www.facebook.com/236086869778323/posts/597301643656842
For this button I used the following code, which is given by Facebook Developers
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/de_DE/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://www.facebook.com/236086869778323/posts/597302473656759" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
When you read the documentation about the Like Button it states
A single click on the Like button will 'like' pieces of content on the web and share them on Facebook. You can also display a Share button next to the Like button to let people add a personal message and customize who they share with.
These pieces of content are external. That is the Like Button is intended to be used for webpages outside of Facebook to share in Facebook.
You will need to use Embedded Posts instead https://developers.facebook.com/docs/plugins/embedded-posts/
When I clicked the LIKE or SEND buttons on my site for this link, I get this error:
The page at http://aftersqool.com/a?id=C217EE could not be reached.
Strangely, the page is loading without any issues. The page even has the og tags that Facebook requires.
Anyone know why Facebook is giving this error? What should I do to get the buttons working?
Thanks!
Gus Collazo
AfterSqool.com
You can’t use the Send Button if you’re using Facebook as a Page instead of a Personal Profile.
The Send Button only works with XFBML version of the Like Button; it doesn't work with the iFrame version of the Like Button, per Facebook’s announcement
One more important thing is to provide your facebook page's URL in send and like button. It will defiantly fix it.
If your facebook page URL is: http://www.facebook.com/aftersqool
put this code in it
/*put this code in body*/
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
/*put this code in site where you want to add it*/
<div class="fb-like" data-href="http://www.facebook.com/AfterSqool" data-width="450" data-show-faces="true" data-send="true"></div>
I could not get Smit Shilu solution to work. I had to remove xfmb=1 to get my buttons to work. Full solution here.
http://metadataconsulting.blogspot.ca/2013/09/facebook-likesend-button-not-working.html
I can't seem to get both scripts working. I am using the jssdk and fb.share to get facebook like box plus facebook share button. But they do not work together. Any idea why? How to fix this?
I have this in header:
<div id="fb-root"></div>
And this code in footer:
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
This is my Fb.share code:
<div class="shr-fb">
<a name="fb_share"></a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>
They make conflict with each other and I do not know how to resolve this situation.
Thank you.
Makes sense.
The facebook share is deprecated and no longer supported, as you can read in the docs:
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.
(reference: http://developers.facebook.com/docs/share/)
And:
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.
(reference: http://developers.facebook.com/docs/reference/plugins/like/)
Instead, use the Like button and you won't run into conflicts.
Meanwhile, you can still combine both Like and Share buttons together with FaceBook JSSDK Api and the html snippet for that is;
<div class="fb-like" data-share="true" data-width="450" data-show-faces="true">
</div>
It will display both the Like and Share buttons functioning as required.
I have added the Facebook button "LIKE" code below:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://www.facebook.com/mypageinfacebook?sk=myappId" data-send="false" data-layout="button_count" data-width="21" data-show-faces="true"></div>
But the like count is not seen on my site, it could be seen only after login in to Facebook account.
How to fix it?
your code wise no wrong..,
Check your data-href link has valid one,
data-href="https://www.facebook.com/mypageinfacebook?sk=myappId"
i tried this code with my fans page url its shown the like counts perfectly..
otherwise,
the page which users wants to like might having '0' likes.
if that case means count wont show.
I think you better to use this one this reference is working..
http://developers.facebook.com/docs/reference/plugins/like-box/
Posting this response for other users that come across this post.
"It seems you are using restriction on "minimum age" or "country" on your page.
That mean facebook can't display a like box, without knowing who is connected, because he can't know the age or the country of the current user."
All credit to AHWEBDEV
Link