Search code examples
facebookonclickfacebook-likehttp-redirectfacebook-likebox

Redirect user to a specific URL after he Likes the page?


Is it possible with the Facebook OpenGraph's and API's to redirect user to a specific URL after he Likes a certain page?


Solution

  • It's possible.

    rather than using a like social widget (which is the common way to like a page), you should implement your own button or link, which calls a Graph API method to like the page, then in use the api callback to navigate the user to a different url.

    You can use facebook javascript SDK to call a Graph API method.

    in this example:

    FB.api(pageId +  '/likes', 'post' ,function(response) {
        //redirect the user to a page;
    });
    

    using "post" in the second parameter will like, using "delete" in the second param will "unlike"