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 994649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:36:24+00:00 2026-05-16T06:36:24+00:00

I am building an Facebook IFrame App. I am using the below javascript code

  • 0

I am building an Facebook IFrame App. I am using the below javascript code to request user to login and allow permissions for the application, after which they are supposed to be redirected to the iframe app. The code works correctly. But, I have two issues with it.

a. as soon as the app loads in IFrame, it redirects to a page (http://www.facebook.com/connect/uiserver.php?app_id=…...) and displays a large facebook icon. When I click this icon it redirects to facebook login page. I want my app to redirect to the login page directly instead of showing the inbetween facebook icon page.

b. When the user clicks ‘Allow’ button for the requested permission in facebook, the page redirects to my main site (http://www.mysite.com) instead of the iframe application(http://apps.facebook.com/myapp).

I have pasted my javascript below, this works with above quirks.

var api_key = 'xxxxxxxxxxxxxxx';
var channel_path = 'xd_receiver.htm';

FB_RequireFeatures(["Api"], function () {
    FB.Facebook.init(api_key, channel_path);
    var api = FB.Facebook.apiClient;
    // require user to login
    api.requireLogin(function (exception) {
        FB.Connect.showPermissionDialog("publish_stream");
    });
});

Help much appreciated.

  • 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-16T06:36:24+00:00Added an answer on May 16, 2026 at 6:36 am

    Thanks for your answers.
    I used the solution posted by McKAMEY(Facebook API: FB.Connect.requireSession issues) with few changes, and it works as intended, without showing the intermediate facebook icon page, and also it redirects after authentication to the iframe app correctly.

    I have posted below the working solution in case someone needs it.

    var api_key = 'xxxxxxxxxxxx';
    var channel_path = './xd_receiver.htm';
    var canvas_url = "http://apps.facebook.com/myappxxxx/"// ensure your canvasurl has a '/' at the end!
    
    function Initialize() {
        FB_RequireFeatures(["Api"], function () {
            FB.Facebook.init(api_key, channel_path);
            FB.ensureInit(function () {
                FB.Connect.ifUserConnected(
            function () {
                var uid = FB.Connect.get_loggedInUser();
                if (!uid) {
                    authRedirect();
                    return;
                }
            },
            authRedirect);
            });
    
        });
    }
    function authRedirect() {
        //This is the Sample URL Structure for redirecting to facebook 
        //http://www.facebook.com/connect/uiserver.php?
        //app_id=XXXXXXXXXXXXX&
        //next=xxxxxxxxxx_success_url_here_XXXXXXX&
        //display=page&
        //perms=XXXXXX_comma_seperated_permissions_list_hereXXXXXX&
        //fbconnect=1&
        //method=permissions.request
    
        window.top.location.href = "http://www.facebook.com/connect/uiserver.php?app_id=" +  encodeURIComponent(api_key) + "&next=" + encodeURIComponent(canvas_url) + "&display=page&perms=publish_stream&fbconnect=1&method=permissions.request";
    }
    
    Initialize();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm building a RoR app for facebook using FBML and the Prototype JavaScript library.
I'm building a facebook iFrame application that uses facebook comments. When a user leaves
I am building a Facebook app using iframe rendering. I want to use CodeIgniter
I am building a facebook canvas app and i am using the signed request
I am building an iFrame and am using document.location.href -> my exact code is:
I'm building a website that allows user to connect using Facebook Connect. So far
I'm building an iframe app that will have a few mentions of the Facebook
I am building a facebook app using heroku. I used: gem install taps It
I'm building a facebook connect app to publish content to user's streams. In order
I am building a facebook platform web app using GWT and hosting it on

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.