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

  • Home
  • SEARCH
  • 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 6332005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:10:50+00:00 2026-05-24T18:10:50+00:00

I have a Facebook app which loops forever when run in IE. In other

  • 0

I have a Facebook app which loops forever when run in IE. In other browsers it works fine.

I need your help to debug this, but before that I need to mention how I have implemented it.

FB recommends that when user tries to access the app we should redirect the user to the app authorization page. From there FB will redirect (using 302 code) to an url which we like. In this case I ask FB to redirect to my app’s url with a flag appLogin=1 in query string. But along with that FB attaches a really long param code in the query string which is quite ugly. So, in this case I put a flag LoggedIn in my PHP session and redirect the user back to the app url using a JS code window.top.location.href = <app url>. This cleans the url in the location bar.

This works fine in Firefox and Chrome, but in IE LoggedIn flag is missing from the session after the code redirects from appLogin stage. In fact it seems the PHP session has reset in this case. This confuses my app into believing that this is an initial request so it redirects user to the authorization page.

I hope the above makes sense. Really appreciate any insight.

Update1:

As requested. Here goes the code snippet.

$reset = false;
$topRedirect = true;

if (isset($_REQUEST['appLogin'])) {
    resetSession();
}
session_start();

$facebook = new Facebook(array(
  'appId' => $AppId,
  'secret' => $AppSecret,
  'cookie' => true,
));

if (isset($_REQUEST['appLogin'])) {//Comes here when appLogin is set, i.e. we have just been redirected here from OAuth (authorization) page.

    if (isset($_REQUEST['error'])) {
        if ($_REQUEST['error_reason'] === 'user_denied') {
            $msg = "You need to click on 'Allow', so that this App can fetch the data needed.";
            $allowRetry = true;
            include('error.php');
        }
    }

    $authToken = $facebook->getUserAccessToken(); //This was originally protected. Made public for my purpose.
    if ($authToken === false) {
        //If no user token found and it wasn't even an error then this is totally unexpected.
        $msg = "Totally unexpected error occurred!";
        $allowRetry = true;
        logErr($msg);
        include('error.php');
    }

    $_SESSION['LoggedIn'] = 1;
    $reset = false;
    $url = $AppUrl; //We redirect again to clean the url.
    include('redirect.php');
} else {
    if (!isset($_SESSION['LoggedIn']) || $facebook->getUserAccessToken() === false) {
        //If we are here then this is an initial request.
        $reset = false;
        $url = $OAuthUrl;
        include('redirect.php');
    }
}

$accessToken = $facebook->getAccessToken();

Update2:

The included files – redirect.php and error.php invoke exit() when their processing is done. So the code after them won’t get executed.

  • 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-24T18:10:52+00:00Added an answer on May 24, 2026 at 6:10 pm

    It’s a problem with redirects. IE handles them differently.

    You can solve that with a simple P3P policy HTTP header you can send:

    P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
    

    In PHP, that would be:

    header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
    

    The reason is that IE needs P3P policies in place when using frames, since your application runs inside an iframe and its parent belongs to a different domain (this case Facebook.com), then cookies will not work (unless P3P policies are being set). And since cookies won’t work, then you are probably looping with your redirects used to login to Facebook.

    Solution: need to implement P3P header to tell the browser that cookies for your application inside iframe are OK for user privacy.

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

Sidebar

Related Questions

I have a facebook app which run only through a fan page. Go to
I have a facebook app, which works with fbjs/flash/python. From yesterday I have been
I have a Facebook app which posts news from a company website to the
I have an open-source app which uploads photos to Facebook. To save bandwidth, the
I have an app where users can sign up with Facebook, in which case
I have this link which i need to translate in a php variable. http://www.facebook.com/dialog/apprequests?app_id=346824075388300&to=1149862205&message=Facebook+Dialogs+are+so+easy%21&redirect_uri=http%3A%2F%2Fpenelope-ns.net%2Ffb%2F
We have created a facebook-app which contains a fb:comment field. We have included the
I have an app which requests infomation to facebook then get infromation from facebook.
I have a Facebook app ID which I'm using on 6 iOS apps for
I'm trying to retrieve in my android app(in which I have facebook integrated )

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.