Skip to content

Instantly share code, notes, and snippets.

@abronte
Last active February 13, 2016 22:32
Show Gist options
  • Save abronte/4402663 to your computer and use it in GitHub Desktop.
Save abronte/4402663 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Like Test</title>
</head>
<body>
<div id="fb-root"></div>
<a href="http://thefacebookdev.com/2012/12/facebook-like-button-events/">Original post</a>
<h1>Hello World</h1>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
<script>
window.fbAsyncInit = function() {
FB.Event.subscribe('edge.create', function(response) {
console.log(response);
alert('Thanks for liking!');
});
FB.Event.subscribe('edge.remove', function(response) {
console.log(response);
alert('Sad to see you dont like me :(');
});
};
(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>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment