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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
</head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<body>
    <div id="fb-root">
    </div>

    <script type="text/javascript" language="javascript">
        window.fbAsyncInit = function () {
            // init the FB JS SDK
            FB.init({
                appId: '140536862789242', // ur app id
                status: true,
                cookie: true,
                xfbml: true,
                oauth: true, // enable OAuth 2.0
                channelUrl: 'http://www.yoursite.com/channel.html' //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); js.id = id;
            js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
            fjs.parentNode.insertBefore(js, fjs);
        } (document, 'script', 'facebook-jssdk'));
    </script>

    <fb:like href="https://www.facebook.com/Bridzetech" send="false" layout="button_count" width="450" show_faces="false"></fb:like>
</body>
</html>



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