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

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.

Related

Fanpage tab redirect to app canvas

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.

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 Link FB Share button to URL inside Application?

I have multiple share buttons inside my application. When i click them it shares the link of the iframe for example:
www.mypage.com/?whatever=whatelse
But i need to share this link with the facebook page "around" so the link is in he facebook iframe inside my apllication:
www.facebook.com/mypage/app_123456789/?????????????????
Is it possible to set some parameters to deeplink inside my application for sharing ?
Right now i just share the index page of my application without any parameters or a specific url inside.
You'd have to use the signed_request variable to store the the page you wanted to share. From what I remember there is an app_data field in this that allows you to store custom values - https://developers.facebook.com/docs/authentication/signed_request/
You'd then have to extract the custom variable from the signed_request->app_data when the page is requested to determine which content to load. You could then obviously share the link to the fb page with the signed_request tacked on. It is still requesting just one page, but kinda simulates deep-linking.

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

Sharing an app that is on a facebook fan page

Afternoon,
I have a facebook application that i have added to a facebook fan page, this application has an URL like http://facebook.com/fanPage?sk=app_id. Now i if copy this link and try and share it on the facebook fan page it uses the description/image from the page and not from the application like it want.
Is there any way to change this? The correct meta tags are in place.
Peter
yes there is a way, but not directly. facebook always fetches the meta tags of the top page, as your app runs in an iframe its not fetched.
but you can submit a wallpost (as user or as a fanpage) via the api and give alle information you want. (like image, video, description, title, ....)
see http://www.fbrell.com/fb.ui/feed for an example.
An other variant:
You add a canvas app beside your facebook app. (see the app settings) on this page you add the meta tags for the wallposts, and a javascript which redirects to the fanpage like
top.location.href = 'http://www.facebook.com/mypage?sk=app_id'
when ever you want to share you use the canvas app url. Facebooks greper ignores the javascript redirects but read the meta tags. A user clicking the wallpost is automaticly redirected to the fanpage - tab.