Fanpage tab redirect to app canvas - facebook

We are creating a canvas app and would like to add directly to my fanpage.
There are 2 ways that I'm not sure about how to take the user to the app's fanpage.
First would be to create a tab and add it in the fanpage.
On this tab would have some text and a call-to-action to redirect to app canvas.
Would create a second tab and add it in the fanpage only with a redirect to take the user directly to the fanpage of the app.
Is there any documentation specific to this practice or some restriction to redirect the tab?

To see if your app was loaded inside a page tab, parse the signed_request server-side and look if there is a page-id set.
If so, answer that request with a minimal HTML document containing not much more than a piece of JavaScript code to redirect inside the top window instance, like this:
top.location.href = "https://apps.facebook.com/yourappsnamespace";
There should be no restrictions on that – Facebook is only worried about automatically redirecting users away from Facebook (to outside domains), but since you are redirecting to a canvas app, they stay on their site.

The docs clearly state:
We do not accept Canvas pages that redirect to Page Tabs, or vice
versa.

Related

Facebook tab iframe sharing

i have a tab in a page, with an iframe to a site built up to be like a simple facebook app, where users can create simple profile pages with an image and some text.
Now, once the profile is created (which is a simple html page with its own URL), i need to be able to share it, using some sharing services (like addthis) or even the standard send button. The problem is that the original site has to be always hidden (users have to not be able to see the URL of the "site"), but the sharing system need an absolute URL to know... what to actually share.
Obiouvsly, working in an iframe, the url is always that of the facebook page (it doesn't change navigating the site's pages), so how can I do this?
Thanks.
The problem is that the original site has to be always hidden (users have to not be able to see the URL of the "site")
Why not?
Please don’t say “security concerns” right now, because you should know there is no such thing as “security by obscurity” …
If you just want to have Open Graph URLs, that can be liked and shared, but want the user clicking on one of those URLs end up being in your iframe tab on Facebook again – then do a redirect to your page tab for actual users.
Either do it via JavaScript (which the Facebook scraper does not care about); or with a server-side redirect for any client that is not the Facebook scraper (it’s identifiable by it’s user agent or originating IP address of the request).

How to embed fbApp within fbPage in a specific way?

how can I embed my app in my facebook page in a way as here:
www.facebook.com/SzkolaSTRAMA?v=app_323694844330149
I have attached the app to my page using the magic url:
http://facebook.com/add.php?api_key=&pages=1&page=
and tried to open somehow the app within using the v parameter, but it seems it is not that. Can someone give me a clue? Thanks.
Now you can add an application to a page in a page tab by going to below mentioned url
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
You need to change "app_id" with your app_id, you can find it in app settings, "Your_url" should be replaced with your application complete url for e.g. "https://www.facebook.com/TestApplication?sk=app_389610254390000"
after changing values press enter, If you are admin of any Facebook page then you will be taken to a screen where you can select the page, after completion of this step your app will be added to page tab.
For further clarification go to this link
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
YOUR_URL should be replaced with your Canvas url.
(The page that is being loaded into iframe on facebook)
APP_ID with id of the Page Tab application.
Explained also here
https://stackoverflow.com/a/10535905/1520297

Publishing action for Canvas (iframe) apps

I've provided my canvas app with all required for publishing actions to Facebook. After I publish an action I have a message like "John made an action over {SomeObject}" in my timeline. Everything works OK but the {SomeObject} i click opens in a window, not in facebook iframe where my app usually works. The URL of this link is rendered like this:
https://www.facebook.com/connect/uiserver.php?app_id={my_app_id}&method=permissions.request&redirect_uri={my_object_url}&response_type=code&display=page&auth_referral=1&fb_private_mode_enc={some_text_string}
What should i do to make my clicked object open in facebook iframe, not window? Can i somehow change display=page to display=iframe in this URL?
Thanks!
I've been having this problem too - I'd like to be able to direct a user straight to my canvas app. Added to this, unless the meta in {my_object_url}'s HTML lines up with what Facebook expects to see, the link resolves to a "this app is having a problem" dialog.
A possible workaround for you, not so much a 100% answer: allow the redirect, but in the meta of the page being redirected to, do an HTML refresh back to the app canvas? This would redirect users back to the app.
If you needed to direct them to a specific page of the app, you could use an app_data signed request addition to the canvas-redirect URL.
Hope this helps. Not a silver bullet though.
PG

How do you link to a page within a facebook iframe?

For example, I have the application starting at index.php. The user navigates to about.php within the iframe, likes that specific page and shares it. What would the structure of the url look like to take people clicking from their own timeline into that page of my iframe?
Thanks!
This depends, if you are on a FanPage it does not work (directly)
on a App Page its easy. You simpley dont link relative in your iframe, but outside to the facebook page itself, for this to work your Canvas url needs to be a directory.
Then you can link to ie. http://apps.facebook.com/yourcanvas/about.php (dont forget the target _top)
On a FanPage the only way i know is to use beside the tab setting, a canvas app page.
in your share code you set the app page as target (with parameter) and on the app page you set a session variable for the desired target and then redirect back to the fanpage.
on the fanpage you look if you have an target value in your session, if so redirect the user.

Facebook Page Tab/Facebook Canvas App/Fan Page

This all sounds confusing;
I have a Facebook Canvas App with the same name as the Fan Page. I would like to add an iFrame tab to the Fan Page to promote and link to the Canvas App. My question is do I have to create a new app for the iFrame tab, or do I open my app settings for the canvas app and add settings for a page tab as well in there. Facebook don;t seem to have much documentation and they are changing things for app profiles soon, so I want to make sure I keep my fans of the page.
Thanks in advance.
Basically it goes like this.
You have an iFrame app.
The iFrame app has a canvas which is where you load your html for your app from your webserver with whatever language you want (.NET, PHP etc)
Then you can add this iFrame app to your page.
When you go to http://apps.facebook.com/yourappname
You will be shown the app by itself. When you add it to your page and load it via the tab on the menu of your page it will show you the app within the space on your page (an iframe).
You can use code to detect whether you are on a page or not to display different things.