Sunday, 17 March 2013

"  Click event of facebook like button...  "

How to know user has clicked on like button ??
ans is save below html file and run in your browser. 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xmlns:fb="">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
    <div id="fb-root">

    <script type="text/javascript" language="javascript">
        window.fbAsyncInit = function () {
            // init the FB JS SDK
                appId: '140536862789242', // ur app id
                status: true,
                cookie: true,
                xfbml: true,
                oauth: true, // enable OAuth 2.0
                channelUrl: '' //custom channel

            // Additional initialization code such as adding Event Listeners goes here
            FB.Event.subscribe('edge.create', function (response) {
                alert("user has clicked on like...");

            FB.Event.subscribe('edge.remove', function (response) {
                alert("user has clicked on unlike...");

        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); = id;
            js.src = "//";
            fjs.parentNode.insertBefore(js, fjs);
        } (document, 'script', 'facebook-jssdk'));

    <fb:like href="" send="false" layout="button_count" width="450" show_faces="false"></fb:like>

edge.create event is fired on when like is clicked, and edge.remove is fired when user clicks on unlike...