Canvas page leaves facebook frame on "Open in New Window"

Dec 10, 2007 at 3:28 PM
Edited Dec 10, 2007 at 3:58 PM
Traditional navigation around my facebook app works fine. But when a user right clicks any link on my website and selects "Open in New Window", the new page will no longer be shown within the Facebook frame. Rather, it opens up with my domain url. (i.e. http://mydomain.com/Default.aspx)

Is there away around this so that all my links will remain inside the facebook frame? I'm thinking absolute linking will work, but that will be a pain when i'm debugging on my localhost.

any help would be appreciated.

Thanks!

***As a side note, if I were using the Facebook.NET toolkit, i could use the <fb:FacebookHyperLink> control to accomplish this
Dec 10, 2007 at 5:21 PM
Our app (Survey Hurricane) had the same issue actually. What we did was use absolute linking. Yeah, its a little bit of a pain when localhost debugging though. The other thing we did was setup a test app and store the api key and secret in the web.config file. For me, its just something I dealt with...if anyone else has another suggestion, please let me know.
Dec 10, 2007 at 5:51 PM
Edited Dec 10, 2007 at 6:41 PM
thank adbaker for the quick response.

for now, that's what i'll do, but it's a lot of trouble changing all the links to absolute ones.

any other suggestions?
Dec 10, 2007 at 6:50 PM
Edited Dec 10, 2007 at 6:50 PM

adbaker wrote:
Our app (Survey Hurricane) had the same issue actually. What we did was use absolute linking. Yeah, its a little bit of a pain when localhost debugging though. The other thing we did was setup a test app and store the api key and secret in the web.config file. For me, its just something I dealt with...if anyone else has another suggestion, please let me know.


hey adbaker,

i have a question about the Survey Hurricane app you created.

I want my the main menu for my application to function like yours. When you click on a menu item, that corresponding menu item will be highlighted with a different color. Accordingly, whichever page the user is on will have the corresponding menu item highlighted.

i was able to accomplish this using the MENU control along with a SITEMAP, but once I change my links in the SITEMAP to absolute links, the highlighting feature was no longer working.

is your menu created the same way? If so, how did you get the highlighting to work using absolutey links?

I appreciate any help you can give me.
Dec 10, 2007 at 10:09 PM
Heh, yeah, that navigation was a pain. What I actually did was write a script to parse it out and dynamically choose the CSS class based on the request.url() and the url I passed into the function.

I don't have the code with me right now, but it was essentially something like:
In .aspx

<li><a href='http://app.facebook.com/myapp/myurl.aspx' class='<%= getCSSClass("myurl.aspx") %>'>Home</a></li>

And in the .aspx.vb

public function getCSSClass(strURL as string) as object

if instr(request.url.tolower, url) = true then
return "selected"
else
return "normal"
end if

end function

Kind of a hack, but hey it worked, so whatever. :-D
Dec 11, 2007 at 10:57 AM


jmoney wrote:
Traditional navigation around my facebook app works fine. But when a user right clicks any link on my website and selects "Open in New Window", the new page will no longer be shown within the Facebook frame. Rather, it opens up with my domain url. (i.e. http://mydomain.com/Default.aspx)

Is there away around this so that all my links will remain inside the facebook frame? I'm thinking absolute linking will work, but that will be a pain when i'm debugging on my localhost.

Try to add this to the Head:

<script type="text/javascript">
var purl = "http://apps.facebook.com/yourappname/"
if(!window.parent||parent.location != purl)
window.location = purl + "Settings.aspx";
</script>

Of course, this only works when JS isn't disabled.

hth,
Tiradentes