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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:17:34+00:00 2026-06-05T05:17:34+00:00

I have a strange behavior for an application that I have implemented and that

  • 0

I have a strange behavior for an application that I have implemented and that captures the user’s info when accessed.
The application, if accessed from outside Facebook URL, pops-up correctly a JavaScript permission dialog.
But when I inserted this application as a tab application into a Facebook page the permission request dialog doesn’t pop-up anymore. Moreover, I have also placed in an FB.getLoginStatus() implementation the detection of the user’s current login status in Facebook, with a JavaScript alert pop-up window if the user is not logged in. When the application is called from ‘outside’ the alert is triggered. When the application is on a Facebook page tab it doesn’t.
Is this the correct behavior? If so, how can I enable the permission request in a Facebook tab application. I’m using both JS and PHP Facebook SDKs.

Edit 1 (following CBroe comment):
I’m using the following calls in the application’s content.php markup (executed on page load):

<!-- Facebook JS SDK initialization -->
  <div id="fb-root"></div>
  <script>initFacebookJSSDK();</script>
<!-- End of Facebook JS initialization -->
<script>checkAccessPermission();</script>
<?php include_once 'sites/www.mysite.com/custom_code/custom_index.php';?> // I'm doing  
custom code under Drupal

The JavaScript functions are implemented in the custom.js file, as following:

function initFacebookJSSDK()    {
window.fbAsyncInit = function() {
    FB.init({
      appId      : 'xxxxxxxxxxxxxxxxxx', // Application's ID
      channelUrl : 'www.appsite.com/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true,  // parse XFBML
      oauth      : true // enable OAuth
    });
.........
    });
.........
}
function getPerms() {
    FB.login(function(response) {
        if (!response.authResponse) {
            //user refused to grant permissions, redirect to the 'index' page
        window.location = "/index";
        }
    }, {scope:"email"}); // I request the permission to get the email address
}
function checkAccessPermission()    {
FB.getLoginStatus(function(response) {
    if (response.status === 'connected') {
          //user has granted permissions to the application
      var uid = response.authResponse.userID; // not used
          var accessToken = response.authResponse.accessToken; // not used
    }
    else if (response.status === 'not_authorized')
        // user is logged into Facebook but didn't grand permissions to the app
          getPerms();
    else {
        //user has not granted permissions, redirect to the 'index' page
    alert('Please connect with your Facebook account');
    window.location = "/index";
      }
 });
}

The PHP script – file ‘custom_index.php’ contains the following snippets:

$config = array();
$config["appId"] = FB_APP_ID;
$config["secret"] = FB_SECRET_ID;
$config["cookie"] = true;
$facebook = new Facebook($config);
// get user UID
$fb_user_id = $facebook->getUser();
// user's first visit, force the permission request window
if ($fb_user_id == 0)  {
    $location = $facebook->getLoginUrl(array('scope' => 'email'));
    ..........
}
// user already gave permission, get the profile and process
if ($fb_user_id != 0)  {
    $access_token = $facebook->getAccessToken();
    $user_profile = $facebook->api('/me', array('access_token'=>$access_token));
    ..........
}

Again, it works very well when the user visits the site outside Facebook, but the permission request pop-up window doesn’t show-up when it runs as Facebook tab application (frame inside Facebook). To note that, concerning my previous posting, now the JavaScript statement:

alert('Please connect with your Facebook account');

is executed in both cases, including when the application is run as tab app inside Facebook (I had just to clear the browser’s cache).

  • 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-06-05T05:17:35+00:00Added an answer on June 5, 2026 at 5:17 am

    Here is the solution.
    All the code above is correct and stays in place.
    I just added a jQuery function on the link that pulls-up the ‘content.php’ page, as following (the class ‘.open-content-page’ is on the parent page of ‘content.php’):

    $(document).ready(function () {
                $(".open-content-page").click(function()    {
                checkAccessPermission();
                });
    });
    })(jQuery);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some strange behavior occurring in an ASP.NET application that I am trying
I have an e-commerce application that is exhibiting strange behavior. The product is a
We have an iOS application for the iPad that is having strange behavior. We
I have a simple HTML (as HTA) application that shows strange behavior on Windows
I have a horizontal animated menu that has a strange behavior because it works
We have really strange and inconsistent behavior with Linq-to-SQL here. Our application is installed
’m observing a strange behavior from my application which I hope you can explain
I am getting some strange behavior involving database queries that I have never seen
I have a strange behavior of Rails 3.0.10. Got this application controller: app/controllers/application_controller.rb require
I'm having a strange problem here... I have an ASP.NET 3.5 application that has

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.