Search code examples
facebooktabsfacebook-canvasfacebook-page

Fanpage tab redirect to app canvas


We are creating a canvas app and would like to add directly to my fanpage.

There are 2 ways that I'm not sure about how to take the user to the app's fanpage.

First would be to create a tab and add it in the fanpage. On this tab would have some text and a call-to-action to redirect to app canvas.

Would create a second tab and add it in the fanpage only with a redirect to take the user directly to the fanpage of the app.

Is there any documentation specific to this practice or some restriction to redirect the tab?


Solution

  • To see if your app was loaded inside a page tab, parse the signed_request server-side and look if there is a page-id set.

    If so, answer that request with a minimal HTML document containing not much more than a piece of JavaScript code to redirect inside the top window instance, like this:

    top.location.href = "https://apps.facebook.com/yourappsnamespace";
    

    There should be no restrictions on that – Facebook is only worried about automatically redirecting users away from Facebook (to outside domains), but since you are redirecting to a canvas app, they stay on their site.