How could I change window’s location without reloading and # hack?

Facebook is using the history api in HTML5. From this blog post you can see how this works. Basically they are making calls like the one below to change the url without reloading the page. window.history.pushState(“object or string”, “Title”, “/new-url”); Here is the HTML5 working draft spec about it: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-location-interface Sadly, IE9 does not support … Read more

Post message to facebook wall from android fb sdk always error

The fix is: if (parameters.get(key) instanceof byte[]) { instead of if (parameters.getByteArray(key) != null) { on line 63 of Util.java. And if (params.get(key) instanceof byte[]) { instead of if (params.getByteArray(key) != null) { on line 155 of Util.java. For some strange reason, on Samsung Nexus S (perhaps other devices too) it returns a String, not … Read more

Getting username and profile picture from Facebook iOS 7

This is the simplest way I’ve found to get the user’s profile picture. [[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *FBuser, NSError *error) { if (error) { // Handle error } else { NSString *userName = [FBuser name]; NSString *userImageURL = [NSString stringWithFormat:@”https://graph.facebook.com/%@/picture?type=large”, [FBuser objectID]]; } }]; Other query parameters that can be used are: type: small, … Read more

Android share intent for facebook- share text AND link

I just built this code and it’s working for me: private void shareAppLinkViaFacebook(String urlToShare) { try { Intent intent1 = new Intent(); intent1.setClassName(“com.facebook.katana”, “com.facebook.katana.activity.composer.ImplicitShareIntentHandler”); intent1.setAction(“android.intent.action.SEND”); intent1.setType(“text/plain”); intent1.putExtra(“android.intent.extra.TEXT”, urlToShare); startActivity(intent1); } catch (Exception e) { // If we failed (not native FB app installed), try share through SEND String sharerUrl = “https://www.facebook.com/sharer/sharer.php?u=” + urlToShare; Intent intent … Read more

Unable to get access token from Facebook. Got an OAuthException says “Error validating verification code”

I recently dealt with exactly this problem: everything matched, but it failed with the OAuthException. The thing that made it work was to change the redirect uri (in both requests for the flow) from: http://foo.example.com to http://foo.example.com/ I.e., add the trailing slash. And then it worked. Stupid and silly, but there you go.

facebook error ‘Error validating verification code’

There are presently (as of March 2011) undocumented requirements regarding what makes a valid redirect_uri. First, both redirect_uri paramaters to authorize and access_token must match. Apparently Facebook (or rather OAuth2) is using the redirect_uri as a internal key to encode the code returned for the access_token request. It’s kinda clever since it verifies back to … Read more

How do I customize Facebook’s sharer.php

What you are talking about is the preview image and text that Facebook extracts when you share a link. Facebook uses the Open Graph Protocol to get this data. Essentially, all you’ll have to do is place these og:meta tags on the URL that you want to share – <meta property=”og:title” content=”The Rock”/> <meta property=”og:type” … Read more

Facebook share link without JavaScript

You could use <a href=”https://www.facebook.com/sharer/sharer.php?u=#url” target=”_blank”> Share </a> Currently there is no sharing option without passing current url as a parameter. You can use an indirect way to achieve this. Create a server side page for example: “/sharer.aspx” Link this page whenever you want the share functionality. In the “sharer.aspx” get the refering url, and … Read more

How to get Likes Count when searching Facebook Graph API with search=xxx

Couldn’t find this in the documentation but multiple calls to the API are not necessary. You can use summary when querying a feed or multiple posts. Specify this in the fields parameter. https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true) This will return a response like this. { “data”: [ { …. “summary”: { “total_count”: 56 } … }, { …. “summary”: … Read more