views:

1523

answers:

4

I'm making an app on facebook and have chosen iframe instead of FBML. The problem i'm facing is linking to various other pages of the app. Suppose that I've hosted my app here http://fbapp.mysite.com and I want to link http://fbapp.mysite.com/page1, how should I do that inside the iframe? Linking directly to fbapp.mysite.com/page1 just redirects the whole browser window from facebook.com to fbapp.mysite.com. I still want the app to very much "live" inside the canvas page, but want to navigate to a page1. Any help will be appreciated.

A: 

Try setting window.location instead of redirecting or set "page1" as your default page in IIS or whatever you use.

Chris Ballance
Reason for DV? .
Chris Ballance
A: 

Thanks for the reply, but I dont know if redirect is the right way to do this, it sounds more like a work around. FB should be having a standard solution to this problem, its just that I'm not able to find it on its documentation page. Anyone who has worked on FB applications should be able to answer this, I'm just hoping they stumble onto this question.

Swamy g
+8  A: 

Instead of

<a href="http://fbapp.mysite.com/page1"&gt;link&lt;/a&gt;

Use

<a href="http://apps.facebook.com/{canvasurl}/page1" target="_top">link</a>

This will load the URL in the topmost frame (Facebook itself), and Facebook automatically passes through any arguments (paths AND query strings) to your callback URL.

Portman
A: 
FB_RequireFeatures(["CanvasUtil"], function() { 
FB.Facebook.init(<api_key>, <path to xd_receiver>);
FB.CanvasClient.startTimerToSizeToContent();
FB.CanvasClient.syncUrl(); 

});

Miha