Facebook应用程序被重定向到我的网站,而不是Facebook上的画布页面。 [重复]

Possible Duplicate:
facebook app getting redirected out canvas view

I have developed an Facebook Application. I have posted the index.php over here. When I click on the App icon from my facebook account i am redirected to the www.mywebsite.com/facebook/index.php page. It should redirect me to the canvas URL of my App - apps.facebook.com/example/, but even after I interchange the appBaseUrl and baseUrl addresses in the code it still gets redirected to my website.

I have used official php-sdk 3.0 that can be downloaded from https://github.com/facebook/php-sdk .

What is the problem? Why is the app not going to my canvas page on Facebook? What changes I have to make in the code below to resolve my problem? If Any one can help me on this, please do answer.

$fbconfig['appid' ] = "XXXXXXXXXXX";
$fbconfig['secret'] = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
$fbconfig['appBaseUrl'] = "https://apps.facebook.com/example/";
$fbconfig['baseUrl'] = "http://www.mywebsite.com/facebook/";

include_once "facebook.php";    

$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
  'cookie' => true,
));

$loginUrl = $facebook->getLoginUrl(
array('scope'=>'email,publish_stream,user_birthday,user_location'));     

if (!(isset($_GET['code'])))
  echo "<script type='text/javascript'>top.location.href = '".$loginUrl."';</script>";

else
 {

  $user = $facebook->getUser();

  try {
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
     err($e); 
    $user = null;
  }

$userInfo  = $facebook->api("/$user");

function err($d){
    echo '<pre>';
    print_r($d);
    echo '</pre>';
}

}

Check your facebook developer settings, make the site_url setting as blank and set the url for facebook app integration.

you should check your Canvas URL, which will display content in facebook app page. if you didn't specify this url in app settings, facebook will redirect user to your Site URL.