Redirecting to a Different URL
Problem
I’d like to redirect users to a different URL from one of my Canvas pages.
Solution
Use the fb:redirect
tag. The simplest (and only) form is:
<fb:redirect url="http://jaygoldman.com" />
Discussion
This tag will only work on a Canvas page, so you can’t use it in
a Profile. It’s a bit of an awkward tag, since it will immediately
redirect to a new URL when someone hits it, which means you’ll need to
wrap it in some page logic if you don’t want the page it’s on to just
send them on their way. You might, for example, use it inside a tag
such as fb:if-is-group-member
:
<fb:if-is-group-member gid="12345" uid="12345"> Private content goes here <fb:else> <fb:redirect url="http://apps.facebook.com/myapp/safe-page"/>. </fb:else> </fb:if-is-group-member>
Get Facebook Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.