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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:27:00+00:00 2026-05-26T22:27:00+00:00

I’ve got a problem with my FB apps with Internet Explorer 7. I’m using

  • 0

I’ve got a problem with my FB apps with Internet Explorer 7.

I’m using this piece of code, provided by FB some time ago :

$auth_url = "http://www.facebook.com/dialog/oauth?client_id=" 
        . FACEBOOK_APP_ID . "&redirect_uri=" . urlencode(CANVAS_PAGE . 'index.php') . "&scope=user_likes,publish_stream";

$signed_request = $_REQUEST["signed_request"];

list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

// If first time we use the application -> ask for permissions
if (empty($data["user_id"]))
{
    echo("<script> top.location.href='" . $auth_url . "'</script>");
}   
// else display the page code
else
{
    }

Using this code, the page loads correctly but then, after 1 second, it reloads and so on, so it gets impossible to use.

By uncommenting the line

    echo("<script> top.location.href='" . $auth_url . "'</script>");

the problem is solved (btw, in my case, the code should not execute this line… It is SO strange that uncommenting a non-used line of code solves my problem but anyway…)

After reading some forums, I had the impression that this issue was a P3P header related one. So I tried to add this line:

header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');

after the body tag. I also tried to add it just before the body tag, and I finally tried to add it as a meta tag:

<meta http-equiv="P3P" content='CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM CURa ADMa PHY ONL COM STA"'>

but none of these 3 options worked for me, and my app still loads eternally.

Anybody has a clue?

Thanks in advance!


Well, I read some forums relating the same problem :

  • http://facebook.stackoverflow.com/questions/5808187/facebook-app-loads-fine-in-firefox-but-keeps-reloading-in-internet-explorer-7-8
  • http://facebook.stackoverflow.com/questions/5986373/facebook-app-canvas-page-keeps-refreshing-on-internet-explorer-ie7

but none of these solutions worked for me, I still have this eternal reloading page problem.

I also read a forum which I thought would solve my problem –
http://adamyoung.net/IE-Blocking-iFrame-Cookies – but again… no luck.

Can anybody help me???

  • 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-26T22:27:01+00:00Added an answer on May 26, 2026 at 10:27 pm

    Couldn’t get you code to work either, it just reloaded. Seems $_REQUEST[“signed_request”] was never set.

    But I got it to work with the code from http://developers.facebook.com/docs/authentication/

       <?php
       $app_id = "your app id";
       $app_secret = "your app secret";
       $my_url = "your app url";
    
       session_start();
       $code = $_REQUEST["code"];
    
       if(empty($code)) {
         $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
         $dialog_url = "http://www.facebook.com/dialog/oauth?client_id=" 
           . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
           . $_SESSION['state'];
    
         echo("<script> top.location.href='" . $dialog_url . "'</script>");
       }
    
       if($_REQUEST['state'] == $_SESSION['state']) {
         $token_url = "https://graph.facebook.com/oauth/access_token?"
           . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
           . "&client_secret=" . $app_secret . "&code=" . $code;
    
         $response = file_get_contents($token_url);
         $params = null;
         parse_str($response, $params);
    
         $graph_url = "https://graph.facebook.com/me?access_token=" 
           . $params['access_token'];
    
         $user = json_decode(file_get_contents($graph_url));
         echo("Hello " . $user->name);
       }
       else {
         echo("The state does not match. You may be a victim of CSRF.");
       }
    

    That said, I would recommend you to use the Facebook PHP SDK, http://developers.facebook.com/docs/reference/php/ that makes programming facebook apps easier.

    EDIT: using the PHP SDK

    To authenticate with the PHP SDK, you would do something like the following:

    // update this to where you've stored the facebook PHP SDK
    require '../src/facebook.php';
    
    $facebook = new Facebook(array(
      'appId'  => 'your app id',
      'secret' => 'your app secret',
    ));
    
    $user = $facebook->getUser();
    if ($user) {
      print "You've logged in!";
    } else {
      echo("<script> top.location.href='" . $facebook->getLoginUrl() . "'</script>");
    }
    

    EDIT: headers

    Also, try setting this in the first lines of you code:

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

    This helped me when the fb session was lost sometimes in an app. Found that in this post:
    How to properly handle session and access token with Facebook PHP SDK 3.0?

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace

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.