Friday, 16 December 2011

Adding the facebook Like button to your website.

Simple enough,
Facebook has made it possible for anyone interested to add the like button to their site.
the code is as shown bellow. Just add this to your source code. and edit the straight forward things...

Note that this is a Javascript code. and alternative codes exist notably iframe php codes. e.t.c
I prefer the javascript though. My reasons would take you into a scripting lesson which I choose to ignore for now.

<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'your app id', status: true, cookie: true,
xfbml: true});
};


(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>


<fb:like href="http://lyndonreid.com/contact" layout="standard" show_faces="true" width="450" action="like" colorscheme="light" /> 

No comments:

Post a Comment