Facebook likes button integration - facebook

My requirement is I need to get like button of facebook in my application for each feed of facebook in a user's wall.
In click of like button, I should update the number of likes in facebook as well as in my application for a particular post. I am using below code but unable to achieve my requirement.
<html xmlns:fb="http://ogp.me/ns/fb#">
<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&appId=297457613664288";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
//div class I am using
<div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div>
</body>
</html>

i this this should works:
<iframe src="http://www.facebook.com/plugins/like.php?href=Your App URL"
scrolling="no" frameborder="0"
style="border:none; width:450px; height:80px"></iframe>

Related

Facebook like button "Internal server error"

Good morning!
I've been testing the Facebook like button by default and I got a recurring error, I've followed the example code from the official site and tried the 2 options, iframe and the other, with booth I got the same error
<html>
<head>
</head>
<body>
<h1>button1</h1>
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fnoudiari.es&width=93&layout=box_count&action=like&size=large&show_faces=false&share=false&height=65&appId" width="93" height="65" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
<h1>button2</h1>
<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/es_ES/sdk.js#xfbml=1&version=v2.7&appId=YOURAPPID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="https://www.facebook.com/noudiari.es" data-layout="box_count" data-action="like" data-size="large" data-show-faces="false" data-share="false"></div>
</body>
</html>
Any help with this?
Thanks guys!
it seems to work for me. Do you have a sample of the page you are using it on ?
It looks like due to all my attempts facebook blocked my account, I tried with another and worked fine.
Thanks

Changing language of facebook Like button doesnt work

I've added the Facebook Like button to this site in wordpress:
http://www.likemaca.com/
However, the like button is still in english, even though it is the danish language code I added to the header:
<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/da_DK/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Any help appriciated
I viewed your blog source code to check if you added the like using iframe or <div class="fb-like">, My predictions were right, you added the like-button using iframe without adding/sending the parameter locale=da_DK to your iframe src
Basically you have two solutions
Stick with the iframe method and add locale=da_DK as below
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FAnchers-Gulvservice-AS%2F309501119143959%3Ffref%3Dts&width&layout=box_count&action=like&show_faces=false&share=false&height=65&locale=da_DK" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:65px;" allowTransparency="true"></iframe>
Notice the last parameter, In this case you won't need the Facebook-JS
Replace iframe with <div class="fb-like">:
<div class="fb-like" data-href="https://www.facebook.com/pages/Anchers-Gulvservice-AS/309501119143959" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
Here you will need the Facebook-JS

facebook like button red error

I embed Facebook like button in my page, but the problem is that, when I login using the like button then the page is liked. But if I already logged in from another page or tab and I clicked the like button a red error is displayed and a message pops up that the message has been blocked by our security system.
My code to embed like button:
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>Facebook Checker</title>
<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>
</head>
<body >
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.google.com" data-width="450" data-layout="button_count" data-show-faces="false" data-send="false"></div>
<script type="text/javascript">
</script>
</body>
</html>
Facebook Like detect suspecious Activity on Localhost. Make a forward account and forward your localy site and past the above code its Works Fine :)
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>Facebook Checker</title>
<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>
</head>
<body >
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.google.com" data-width="450" data-layout="button_count" data-show-faces="false" data-send="false"></div>
<script type="text/javascript">
</script>
</body>
</html>

Facebook Like Box doesn't work

I am trying to use the fb like box, in the generators preview everything works fine. After pasting the generated code in my website and hitting the "like"-button, a pop-up appears, connects to facebook and closes itself again. But nothing happens, i have not liked the facebook page.
Here is the code:
<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 = "http://connect.facebook.net/de_DE/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like-box" data-href="https://www.facebook.com/pages/Verband-Nordrhein-Westf%C3%A4lischer-Omnibusunternehmen-eV/494051873994513" data-width="292" data-height="300" data-show-faces="false" data-stream="false" data-header="true"></div>
Try to put the script after the first tag of your page.
Put the <div class="fb-like-box" data-href="https://www.facebook.com/pages/Verband-Nordrhein-Westf%C3%A4lischer-Omnibusunternehmen-eV/494051873994513" data-width="292" data-height="300" data-show-faces="false" data-stream="false" data-header="true"></div>
where you want to be shown in your page.
Not exactly after the script.

Add the send button in facebook iframe like button

I have this iframe and is displaying the facebook like button but I can not add the send button. what should I add to it? I was trying send=true& but that soes not seems to work
Here is the fiddle
<div style="float:left; margin-left:10px">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com/Eurekavi&layout=button_count&show_faces=false&width=450&action=like&colorscheme=light&height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100%; height:20px;" allowTransparency="true">
</iframe>
<style>.fbook{position: absolute; font-color:#ddd; top:-1668px; font-size:10;}</style>
<style>.fbook-style_map:initreaction=10false_attempt10-border</style>
<style>closemap"init"if=fb_connect-start="25"check_bandwith</style>
</div>
<div style="clear:both"></div>
Facebook developer documentation says: "Send Button (XFBML Only)". So you have to use XFBML for your like/send button:
include js-api once:
<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&appId=[your_app_id_here]";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
include namespace:
<html xmlns:fb="http://ogp.me/ns/fb#">
insert like/send button (multiple times if you want):
<fb:like href="http://stackoverflow.com" send="true" layout="button_count" width="250" show_faces="false" font="tahoma"></fb:like>
hope that helps...
As per Facebook Documentation, You can NOT do this as of now!
Now facebook replaced send with recommend
<div class="fb-like" data-href="http://example.com" data-layout="standard" data-action="recommend" data-show-faces="true" data-share="true"></div>