Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:45:32+00:00 2026-05-27T03:45:32+00:00

My facebook javascript that I added to uses the like button from facebook and

  • 0

My facebook javascript that I added to uses the “like” button from facebook and other components, looks like this:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '164355773607006', // App ID
      channelURL : '//WWW.KOOLBUSINESS.COM/static/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      oauth      : true, // enable OAuth 2.0
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };
  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     {% ifequal host "www.montao.com.br" %}
     js.src = "//connect.facebook.net/pt_BR/all.js";
     {% else %}
     js.src = "//connect.facebook.net/en_US/all.js";
     {% endifequal %}
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
</script>

Can I put it at the bottom of the pages instead of at the top since that will load the page faster?

How do I check that the channel file is working?

Can my channel file be on another domain, though it is the same app (my app serves multiple comains)?

Is there another way for my server to access the session than with cookies?

Is there a better was to switch between Portuguese and English than I did? My way works but perhaps is inferior. A better way could look for HTTP ACCEPT_LANGUAGE or cookie or http get parameter for language. In this case one domain should alway be in portuguese but it would be nice to switch the language on the FB components when a switch my app’s languages with the django_language_cookie. So I suppose I could read the django_language_cookie with javascript instead of checking the domain, but then I’d have to learn how to do it.

Can you comment or help me with my solution?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:45:33+00:00Added an answer on May 27, 2026 at 3:45 am

    Your channel file must be on the same domain, the requesting document is served from.
    Well, you can check if it’s working when you request the URL in the browser and getting content 😉

    I switch the language of the JS-SDK in the following way for my projects:
    With the signed request, there is a “locale” variable passed to your server.
    You can grab it by decoding the SR and accessing $sr[‘user’][‘locale’] (or pass the decoded SR to your template engine and access it via {{SR.user.locale}} – this maps to a string formatted like “en_US” or whatever language the user has set on facebook.
    Embedding the JS-SDK in the correct localization is a snap, then:

    //connect.facebook.net/{{SR.user.locale}}/all.js
    

    Well, if you want to keep only the Protugese/English switch because it would look weird to serve for example german dialogs when your app is only PT/EN, then include it as following:

    //connect.facebook.net/{% if SR.user.locale == "pt_BR" %}pt_BR{% else %}en_US{% endif %}/all.js
    

    But I would stick with the first solution, because the dialogs opened by the SDK would be experienced by the user as a part of facebook – and they would exept it in the language they set facebook to.

    Hope this helps you!
    (Also remember to cache this locale setting if your app has multiple pages, because you only get the RT on the first request 😉 )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have copied this code from the FB.init documentation : <script src=http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US type=text/javascript></script> ...
Whenever I try to disconnect the user from my website that uses the Facebook
Starting from this very nice article about doing facebook integration using the javascript API
Recently I added to my website facebook like button, twitter follow us button and
I have a site that uses the Facebook JavaScript API to allow users to
I need a javascript bookmarklet that will click the Yes button on a facebook
My Facebook application contains Javascript that works in Firefox and IE, but aborts in
I am building a Facebook App which is heavy on Javascript. For this I
I have JavaScript that computes and injects HTML into my DOM for the Facebook
I'm trying to switch over to the new Facebook JavaScript SDK from the old

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.