Adding a “Like” button using the Facebook JavaScript API is easy:
<div>
<fb:like href="">
</div>
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);
} ()); |
<div>
<fb:like href="">
</div>
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);
} ());
n. 1: automatic, but with an element of magic. 2: too complex to understand and/or explain