FB-Javascript API - javascript

I am implementing Facebook feed functionality in my website using 'FB-like-box' I was able to replicate it similar to that shown in Facebook developer site.
But when I again started testing the code(no change has been done) today I am getting additional link in the like box and I am not able to get rid of it.
You can see the additional links 'Like Page', 'Boom Post' in the screenshot. Can some one please advice me how to get rid of the additional links. Please find the 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 = "http://connect.facebook.net/en_US/all.js#xfbml=1&appId=515052318562357&version=2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-container">
<div class="fb-like-box" data-href="https://www.facebook.com/NayaCompLtd" data-width="300" data-ajax="false" height="360" data-colorscheme="light" data-show-faces="false" data-header="false" data-stream="true" data-show-border="false">
</div>

The Like Button is there because it´s a major element of the Like Box.
The "Boost Post" Button is only visible for you, and i highly doubt that you can remove it either.

Related

Facebook login button just won't show up

I went to this page : https://developers.facebook.com/docs/facebook-login/web/login-button
I copied and pasted the code they give, in my HTML index:
<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/sdk.js#xfbml=1&version=v2.8";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
(that's right after the body tag, as they recommend), and then :
<div class="fb-login-button" data-max-rows="1" data-size="icon" data-show-faces="false" data-auto-logout-link="false"></div>
anywhere in the page, it doesn't work. The button does not show up. If I add a red border to it, a vertical red line appears, showing that the button doesn't render.
I have tried with different options, locally, on my server, and in a codepen (http://codepen.io/jeremythille/pen/EWWRdy?editors=1100), no avail.
No error in the console, no problem in the network tab. "sdk.js" is found and loaded.
What am I missing?
You need to initialize the facebook sdk first. See this page: https://developers.facebook.com/docs/javascript/quickstart

Including facebook event on page throws errors

I'm trying to embed a facebook event on my website. I got the code from facebook with the 'embed event' button, but it keeps throwing errors: Invalid App Id: Must be a number or numeric string representing the application id., FB.getLoginStatus() called before calling FB.init(). and This Facebook post is no longer available. It may have been removed or the privacy settings of the post may have changed.
This 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 = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-post" data-href="#" data-width="466">
<div class="fb-xfbml-parse-ignore">
Post
by
User.
</div>
</div>
Note: I replaced all href's with "#" for the sake of my privacy :P
If your website is based on a Wordpress installation please double check your post page source code. If the <script> tag was stripped probably it's caused by the user's permissions. Try to embed a facebook post as Wordpress administrator and it'll work. In my case that was the stupid problem...

Facebook Like Box Won't Appear (Bootstrap)

So this has been driving me crazy, I've been searching similar questions but they all have solutions that seem not to work for me. I am trying to add a like box to my bootstrap website, but it won't appear. I am using the HTML5 version of the widget but have tried others to no avail, have this after my 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 = "js/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I made a local verison of all.js since GET was failing to retrieve it from the Facebook servers, even after I uninstalled Ghostery.
Next, I added my like box using:
<div class="fb-like-box" data-href="MYSITEURL" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true"></div>
With my actual URL of course, and no go, no matter how I arrange the code in a div by itself or anything. Any help is greatly appreciated!
I'm assuming that you're testing the site on a local server, so all you need to do is add "https:" to this line:
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
Like this:
js.src = "https://connect.facebook.net/en_US/all.js#xfbml=1";
Cheers!
I don't think your problem is related to Bootstrap. See http://bootply.com/94974, this use the same code as you do and works well.
Note in your example code js.src = "js/all.js#xfbml=1"; refers to a local all.js where something like //connect.facebook.net/nl_NL/all.js will be needed.
It works without problem. Need to be sure the referred fanpage (data-href) is a valid one.
It can be FB page permissions setup issue. If the page visibility is restricted for audience from specific location(s), then the likebox doesn't appear.

Recall javascript on click in tumblr

I've added the facebook like button on my tumblr page. But each time I click on the "load more" button, the facebook button doesn't appear on the next articles. I think I have to recall the facebook script at this moment to make it work. But i don't know how.
Here is the facebook script I have in my 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/fr_FR/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
And here is the part of the footer where I have to load the rest of the post on my page (I think…):
<footer{block:PermalinkPage} class="individual-footer"{/block:PermalinkPage}>
{block:IndexPage}
{block:IfLoadMoreLink}
<div class="load-more">
{block:IfLoadMoreText}{text:Load More Text}{block:IfLoadMoreText}
</div>
{/block:IfLoadMoreLink}
▲
{/block:IndexPage}
Thx for your help.

Check if user liked my page or not using page url and appId

From https://developers.facebook.com/docs/reference/plugins/like/ I got this script to show the like button in my website
<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/fr_FR/all.js#xfbml=1&appId=155899567847";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-href="http://website.com/project/hello" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
I only have the appId and the url, can I check is current user liked my page ?
I looked in google and I found some examples using PageId and I dont know how to get it
PageID is necessary for checking that page is already liked or not from another source. If you are in the same page (your facebook page) it means there is no need to get that id as it will automatically have it from the session or somewhere else.
You can get the PAGE ID by one of the following way,
http://hellboundbloggers.com/2010/07/10/find-facebook-profile-and-page-id/
http://rieglerova.net/how-to-get-a-facebook-fan-page-id/

Categories