开发者

How can a canvas app redirect to another tab such as the Wall?

I'm trying to create a so-called "Welcome Tab" app for a business page. What I want to happen is that either m开发者_Go百科y canvas app displays a message when a vistor hasn't Liked the page, or the normal "Wall" tab when they have.

I've done this by setting my canvas page as the default landing tab and then checking the 'liked' parameter passed by Facebook and my PHP can successfully deterime what it should be doing. As per this extract:

if ($results['page']['liked'] == 1) {
$redirect = $pages[$results['page']['id']]['liked']; } else {

$redirect = $pages[$results['page']['id']]['unliked']; }

header('Location: '.$baseurl.$redirect);

However using header() to load a page which in turn contains a little bit of Javascript to do a "top.location = http://www.facebook.com/pages/xxxxxxx/yyyyyyy?sk=wall" redirection takes a second or so and results in the visitor seeing a blank canvas page briefly and then a full page reload.

However this page https://www.facebook.com/ourcarnoustie seems to be able to instantly display the Wall to Likers, and its own "Welcome" tab to non-Likers without any apparent delay or refresh.

Any suggestions or pointers would be greatly appreciated. Thanks.


Facebook defaults to the wall for people who've liked the page. In fact it's usually the reverse that's requested on how to set the welcome page for everyone :)

For what you're asking you shouldn't need to do anything as that's the behavior.


Hmmm this is funny you posted this cause I've just landed myself with the same issue today.

I'm using this php currently to change my html between 'liked' and 'not liked...

<?php
    $signed_request = $_REQUEST["signed_request"];
    list($encoded_sig, $payload) = explode('.', $signed_request, 2);
    $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
    if (empty($data["page"]["liked"])) {

//echo 'UNLIKED';

    } else {

//echo 'USER HAS LIKED';

    }
?>

But I also need to find away some how for the users that have already liked the page, to be redirect to the wall - instead of seeing the welcome app.

Because it's inside an iframe, do you think it's possible?

I also looked at that facebook page with welcome app that you said works, and it does work so must be possible unless its an older app that's not using a iframe to pull in the content.


I've found the answer to my own question.

The Facebook Pages FAQ includes this statement:

Why can't I choose a landing tab for existing followers of my Page?

The default landing tab can only be adjusted for people that are not following your Page. Once they follow your Page, they will see the Page's wall as the default.

So people who LIKE the page are automatically taken to the Wall page regardless of the landing tab selected in the Page settings. Therefore the landing tab app doesn't have to do any of the redirection I have been trying to figure out as Facebook already does it anyway!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜