How to redirect a visitor after they "like" your Facebook page


Want to make your website users like your page before redirecting them somewhere? Use this code! HTML:

<div id="fb-root"></div>
//change pagetolike
<fb:like href="http://www.pagetolike.com/" send="false" width="450" show_faces="false" font=""></fb:like>
Javascript:
<script type="text/javascript">
window.fbAsyncInit = function() {
//change to your facebook app id
FB.init({appId: 'YOURAPPID', status: true, cookie: true, xfbml: true});
FB.Canvas.setSize({ width: 520, height: 1500 });
FB.Event.subscribe('edge.create',
function(response) {
// change pagetoredirectto
window.location = "http://www.pagetoredirectto.com/";
}
);
};
(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);
}());
</script>




Shane Stebner

Author: Shane Stebner

Shane is a successful web-developer specializing in responsive design, and the open-source LAMP stack. Over the years, he's gained in-depth experience with Stripe, Twilio, PhantomJs, Authorize.net, PayPal, Facebook, Twitter, and many other plugins/APIs.


comments powered by Disqus