How to redirect to another page after click on facebook like button?

How to redirect to another page after click on facebook like button?

Redirect after a user clicked a facebook like button

How to redirect to another page after click on facebook like button?

Write the following script between head tag.


<script type="text/javascript">

window.fbAsyncInit = function () {
FB.init({
appId: 'Your facebook application Id',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
FB.Event.subscribe('edge.create', function (response) {
window.location = "http://code.top10idea.com";
});
};
(function (d) {
var js, id = 'facebook-jssdk';
if (d.getElementById(id)) {
return;
}
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
} (document));

</script>

And Write the following code between body tag.



<div id="fb-root">
</div>
<div>

<div data-href="http://www.facebook.com/offerfair" data-width="300px"
data-show-faces="true" data-stream="false" data-header="false">
</div>
</div>

About the Author

avatar