views:

201

answers:

2

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?

+1  A: 

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"&gt;Link&lt;/a&gt; -> Renders application page

Good luck!

Gdeglin
You are completely right! I always use `_path` instead of `_url` in rails and just assumed Facebooker was fixing the URLs. Good to know! Thanks for the quick answer!
Pierre Olivier Martel
A: 

You can also use the regular rails 'link_to' function and pass :only_path => false. This will add the host to 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 %>

related questions