Take the 2-minute tour ×

How would I do this but using Graph API to grab locale and display content based on country?.

FB.login(function(response) {
             if data.get('user').get('locale') = "en_GB" {
                $("#footer a").text("URL HERE");
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

If you're using the facebook javascript sdk for authenticating the user, then you get a signed request for the user, as it states in the signed request guide:

When using the JS SDK for authentication, the authResponse object contains a signed_request property which is used to transfer information about the authenticated user.

The signed request has the user field which is:


You should get the locale value even if the user hasn't authenticated your app so that you could show content that matches it.


You have a few ways to get the authResponse, the most basic of which is to use FB.login, like so:

FB.login(function(response) {
    if (response.authResponse) {
    else {
share|improve this answer
Would you happen to have an example based on the JS above please?. –  user1381806 May 10 '12 at 10:59
Added to my answer –  Nitzan Tomer May 10 '12 at 11:27
Then I need to use FB.api to grab locale? e.g FB.api('/me', function(response) { alert('Your name is ' + response.name); }); –  user1381806 May 10 '12 at 12:46
No, you don't need to use FB.api, it's enough to just get the authResponse using FB.login, FB.getLoginStatus or FB.getAuthResponse. –  Nitzan Tomer May 10 '12 at 12:47
Oh so, authresponse then use jquery to run functions based on locale location? –  user1381806 May 10 '12 at 12:54
show 4 more comments

Your Answer


