开发者

Navigate from facebook tab to canvas page

My facebook application has a tab the user can install. On this tab, there is links that are suppose to link to application canvas (ex.: apps.facebook.com开发者_如何转开发/my-app).

It seems that when I'm on my user profile tab and click on a link, Facebook loads the page inside the tab. How do I force it to navigate out of the tab and into the canvas page?


You need to use full urls instead of relative urls.

For example:

<a href="/apppage/content.php">Link</a> -> Renders on tab
<a href="http://apps.facebook.com/yourapp/apppage/content.php">Link</a> -> Renders application page

Good luck!


Use parent attribute in anchor tag.

For example:

<a href="http://apps.facebook.com/YOUR_APP_NAMESPACE" target="_parent">Click Me</a>

This will solve it.


You can also use the regular rails link_to function and pass :only_path => false. This will include the host name into your URL which will be your app's canvas page. When you click it within a Facebook tab, you will go to the app's canvas page instead of staying in the tab.

<%= link_to "Leave the tab", :controller => 'home', :only_path => false %>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜