How can I get the facebook user-agent string when click a link in Facebook app? - iphone

I have created a facebook application that is used for posting a message to the wall. The application works fine. In the message I post there is a link. When I use the iphone facebook app and click this link instead of having Safari open immediately, the url opens in an internal frame of the facebook app and by click the small arrow it has the on the right bottom I can choose 'Open in safari'. This happenes only in iphone.
Is there a way to make my links open directly yo Safari?
Or is there a way yo get at least the facebook user-agent string so as to have a special treatment for this case?
Thanks in advance

Related

Facebook Share Button Creates Stories with link "via" my FB app URL - change to website URL

I don't have 10 reputation points yet, so can't embed image, sorry. Please see the image that can help clarify, right away, what's wrong: http://i.stack.imgur.com/b6BbO.png
I am having issues integrating Facebook buttons on my site. I have created a FB app to use with the integration - my like button (see http://soundsviral.com/2014/02/13/tennis-court-by-lorde-45/) is working just like I want it to. However, the share button next to it returns a story like you see above. The real disconcerting piece is that the link for the "Sounds Viral" name (which is the name of the app here, not the site) links to the app itself, which I don't want users to visit at all.) How can I change this URL to be my homepage (or the link in the post below, if that's preferable?)
I also which I could change "link" here to be "song", which is a supported og:type and is in use for my "like" button. However, for the "share" button, it just says "link". But that's less important to me than the actual URL in the story.
Thanks for any ideas!
The solution is to set your facebook app to be a website app that directs facebook users to your website.
To do this:
go to you app page
go to Settings
click Add Platform button
Select Website option
Enter URL of your website and save

How do I display a facebook app without the apps.facebook link

I have a facebook iframe app which opens properly with a link like https://apps.facebook.com/<app_name>
However I want it to open with a profile like https://www.facebook.com/<name>/app_<app_id>.
For example: https://www.facebook.com/inwi.ma/app_425874907457614
Any idea how this can be achieved?
What you need to do is add this application as a page tab to gain accces to a URL like that.
More info on how to get started with your tab application can be found on Facebook's documentation - https://developers.facebook.com/docs/appsonfacebook/pagetabs/

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 I get back to the iPhone web app after having logged in with Facebook Connect?

I have a mobile web site built using jQuery Mobile. I often run it in full screen/mobile web app mode on my iPhone (I have added the web app to my iPhone home screen).
On one of the pages, the user is required to log in to Facebook using the Facebook Connect JavaScript API. If the user is not already logged in, this is done by clicking a login button. The event handler for this button looks like this:
("#fbLogin").click(function () {
FB.login(handleStatusChange(response),
{ scope: "publish_stream",
connect_display: "touch" });
});
In the above code I have inserted some line breaks for better readability, but the values are like in the example. The callback function (handleStatusChange) takes care of the response from the login request.
When I click this, the Facebook login page is opened in my web app window. If I haven't already accepted the Facebook App, I have to give it permissions as well. All this seems to work fine. But after I have given permissions/logged in I'm left hanging on a totally blank screen.
I have also tried another approach to logging in, by putting this inside the login button event handler:
window.location = "https://www.facebook.com/login.php
?api_key=MY_API_KEY
&cancel_url=http%3A%2F%2Fwww.mywebsiteurl.com%3A8081
&fbconnect=1
&next=http%3A%2F%2Fwww.mywebsiteurl.com%3A8081
&return_session=1
&session_version=3
&v=1.0
&req_perms=publish_stream
&connect_display=touch";
Again, line breaks have been inserted for better readability. When used it's just one long string.
The URL used in the cancel_url and next parameters is the one I have registered with the Facebook Application. If I try using a different URL (like http://www.google.com) I get an error so the this seems to be correct. As you can see I use a different port on my development server (port 8081). Could this be a problem?
The result is similar to the previous example. I get the login/permissions pages but I'm left with a blank screen after everything is done. I tried this after reading this post on the old Facebook Developer forum.
If I, on the other hand, try running this in Safari (not as a full page iPhone web app) the login works great.
Is there anything else I can try? Does anyone have a JavaScript API Facebook Connect login working while running in full screen/web app mode on an iPhone?
Thanks in advance!
Not sure if this helps you, but I found that adding the iOS Safari link fix, also allowed Facebook login to work in my fullscreen web app without opening up the page i "regular" Safari:
// Make links work in iOS fullscreen web app
function disableSafariLinks() {
$("a").click(function (event) {
event.preventDefault();
window.location = $(this).attr("href");
});
}
See also iPhone Safari Web App opens links in new window

Facebook Feed Dialog Mobile Url: Issue with display=wap

I am using this url to direct my mobile web page to a facebook wall post dialog page, however I can't seem to get display=wap to work.
http://m.facebook.com/dialog/feed?app_id=<myappId>&redirect_uri=<myRedirectUri>&link=<myLink>&display=<wap|touch>&picture=<myPicture>&caption=<myCaption>&description=<myDescription>&name=<myName>
Using display=touch works fine on most devices except some blackberries I've tested, where the dialog page is blank except for the "Publish" and "Cancel" buttons. When I use display=wap, I get "An error has occured" no matter what I do.
Does facebook support this feed dialog with display=wap? I found this url on their developer's web page here:
Facebook Dialogs
Under the heading labeled : Mobile Display Modes
I'd appreciate any advice!
Currently we don't support the feed dialog in display=wap. Sorry.