1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to redirect to fanpage tab after "like"

Discussion in 'FaceBook' started by jaredakelly, Sep 12, 2011.

  1. jaredakelly

    jaredakelly Regular Member

    Joined:
    Jan 14, 2010
    Messages:
    376
    Likes Received:
    88
    sorry if this has been posted before (i searched) or is just basic fb marketing 101.

    how do i make my fanpage so that it goes to another tab in my fanpage only after the traffic "likes" my fanpage.

    i want to make it clear that I do not want to use iframe.

    any help would be great!
     
  2. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    You're going to have to use an iFrame as your default tab to evaluate this. Basically, this is how I would do it.

    First, create a tab that utilizes a custom iFrame landing page. The landing will do nothing but evaluate if they already Like the page. You can do this by create an app yourself and adding it to your page, or using an existing Tab iFrame app from the app directory (refer to this post for step-by-step guide on this matter).

    This iFrame will then check to see if the user is a Fan, or not.

    If they aren't a fan you have 2 options. First option is to create a custom landing page to tell them to Like the page first. Second is to redirect them to an existing tab that tells them to Like the page first (no real advantage to doing this instead of the first option).

    If they are a fan, again you can display the content you want them to see, or you can redirect them to the existing tab on your page with the content you want them to see.

    Both of these actions will be controlled by the following code, which needs to be rendered in the default iFrame tab of your page.

    Code:
    <html>
        <head>
            <style type="text/css">body {overflow: hidden;}</style>
            <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
        </head>
        <body onLoad="FB.Canvas.setSize({width: 500, height: 1100})" style="text-align:center;">
            <div id="fb-root"></div>
    
            <script type="text/javascript">
                FB.init({
                    appId : 'YOUR_APP_ID_HERE',
                    status : true, // check login status
                    cookie : true, // enable cookies to allow the server to access the session
                    xfbml : true // parse XFBML
                });
    
                window.fbAsyncInit = function(){  
                    fb.canvas.setautoresize();
                }
            </script>
    <?php
        function parsePageSignedRequest() {
            if (isset($_REQUEST['signed_request'])) {
                $encoded_sig = null;
                $payload = null;
                list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
                $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
                $data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));
                return $data;
            }
            return false;
        }
        if($signed_request = parsePageSignedRequest()) {
            if($signed_request->page->liked) {
    ?>
            Hi, thanks for being a fan! :)
            or...
            redirect them to another tab
            PM me if you want help customizing this script to do that
    <?php
            } else {
    ?>
            Hi, please become a fan by clicking the Like button! :)
            or...
            redirect them to another tab
            PM me if you want help customizing this script to do that
    <?php
            }
        } else {
            header('Location: http://www.url-to-your-fan-page.com/in-case-they-visit-your-page-from-outside-facebook.php');
            exit();
        }
    ?>
        </body>
    </html>
    Don't forget to replace YOUR_APP_ID_HERE with your app ID.
     
    • Thanks Thanks x 5
  3. Fuggz

    Fuggz Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 25, 2010
    Messages:
    583
    Likes Received:
    600
    If you want to go with some simple javascript, this is the code I use (change out "Your App ID and redirect link to the page you want to redirect to:

    Code:
    <head>
    
    <script type="text/javascript">if(top.location != location) { top.location.href = document.location.href ;}</script>
    
    <script type="text/javascript">
    
     function next_page() {
            window.location = "http://yoursite.com/afterlike.html";
    }
    
        </script>
    
    
    <script type="text/javascript">
       
          window.fbAsyncInit = function() {
            FB.init({appId: 'Your app ID', status: true, cookie: true, xfbml: true});
            FB.Event.subscribe('edge.create',
          function (response) {
             next_page();
          });
        
          };
          (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>
        </head>
        <body>
    
    </body>
    Just add your content to the body.

    With this code you can also detect if the user does other things also. You can make a "Comment on this page to reveal" just as easily as a like, or get creative.
    https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

    With the above script I also typically use a redirect when the page unloads anyways to send them to another page if they choose to not like the page or if they press the back button or any other button that would take them off the first page.

    Other things to think about:

    You actually still can use static FBML, you do not have to make an iframe. Visit my post here to find out how to do that:

    http://www.blackhatworld.com/blackhat-seo/facebook/309255-if-you-want-keep-using-fbml.html

    Then you would need the script from this thread:

    http://www.blackhatworld.com/blackh...t-facebook-reveal-code-double-your-likes.html

    And finally, most guys now are using applications that do this easily for you, just add your HTML. There are quite a few, if you need any help PM me for suggested apps.
     
    • Thanks Thanks x 2
  4. mbison1

    mbison1 Newbie

    Joined:
    Feb 20, 2013
    Messages:
    4
    Likes Received:
    0
    Sorry for stealing this thread, but I need somebody to help me.

    I really don't have any idea how to code such a thing (i'm complete noob at web programming)

    I want to create a welocome (aka landing) page on my facebook with fan and non-fan content.
    The non-fan content will be IMG_1.JPG User click "like" and sees next image (IMG_2.JPG) for couple seconds and then my website appears. IMG_2.jpg should appear only once after user have clicked "like" button. Next time when he goes to my fan page he's going to view my facebook website.
    Check my image below:
    tz.jpg


    I would really appreciate if someone take a time to answer me! :)
     
  5. sn0rt

    sn0rt Elite Member

    Joined:
    Jun 12, 2012
    Messages:
    1,705
    Likes Received:
    3,502
    Occupation:
    "Most obstacles melt away when we make up our mind
    Location:
    "Knowing is not enough; we must apply. Willing is
    Lol. This is from back in 2011

    :welcome:

    To help you out, these methods should be outdated. FB doesn't use the same thing they used to use. You're going to have to look up new material on the matter. I'll have to get this done also, but I just haven't taken the time to dig it up.

    If you find a good tut on it, send me a PM
     
  6. doctorbinsibar

    doctorbinsibar Junior Member

    Joined:
    Jul 21, 2012
    Messages:
    174
    Likes Received:
    105
    is not that hard as you think.
    Just use iframe tab search in facebook after "iframe Tab"
     
  7. socialmediahero

    socialmediahero Registered Member

    Joined:
    Feb 20, 2013
    Messages:
    68
    Likes Received:
    14
    Search for Static iframe tab app.
     
  8. bobobog69

    bobobog69 Newbie

    Joined:
    Aug 3, 2013
    Messages:
    3
    Likes Received:
    0
    Looking for a script / system as follows:
    Likehoot
    Powerlike like Facebook status updates, photos? Them etc. How it is purchasing? Some want you to get? Take? Like he goes into the site need access token he should get? Keep this symbol after permission allow Facebook permissions is application can change its pages, as , comments on his behalf after he see permisssions allow him to copy the access token in the box to the site, then it is redirecting? mentioned the following pages introduce the status ID / ID Picture after? key and code automated system that enabled members the site permissions, site as the name automatically enabled without user permission? tie .. I hope someone can help me.