The Facebook JavaScript SDK is a rich set of client-side functionality for adding Social Plugins, Facebook Login and Graph API calls to desktop or mobile web. If you are a blogger, it will also enable you to use the Facebook like button and other Facebook social plugins on your blog.
Below is the default Facebook JavaScript SDK code, with the appid of my blog in it :
<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&appId=150436614997987“;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>
Facebook requires that you add the code right after the opening <body> tag in your blog’s html to enable Facebook social plugins work on your blog.
Unfortunately, adding the code to your Blogger blog might throw some xml error. So, in this post, I want to share with you, how to add the Facebook JavaScript SDK to Blogger themes without throwing xml error.
Steps
Sign in to your Blogger dashboard, click on “Theme”
Click on “Edit HTML”
Use “CTRL F” to find the opening <body tag
Right below it, paste this code :
<div id=’fb-root’/>
<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&appId=150436614997987";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Change the highlighted appid to the application id of your blog.
Click “Save Theme”.
If saved successfully, it will look like this:
Recommended : How To Generate Facebook appid For Your Blog
If you don’t know your blog app id, use the code below:
<div id=’fb-root’/>
<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&appId=";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Alternatively,
Add <div id=’fb-root’/> below the opening <body tag
Copy the script part of the default code and parse it.
After parsing it, paste it directly below the <div id=’fb-root’/>
Click “Save Theme“
I hope this helps.
nice one mr jide check me at
http://www.nobleshub.com
Thank you boss
Check out my design
nice write up. it really help my my blog. you can check it [url=www.eaglegist.com] HERE [/url]
please how do i get the application id of my blog
Nice blog of javascript thanks for sharing this informative blog.
I really appreciate your time I used this and it worked fine