2011-03-01 2 views
0

내가 문제가되는 것은 사용자가이 페이스 북 iframe 앱에 처음 로그인 할 때 페이 스북 로고가있는 빈 페이지로 전송된다는 것입니다. Followin은 스크린 샷입니다. enter image description here처음으로 페이스 북 앱에 갈 때의 문제

다음 , 나는 새로운 PHP SDK를 사용하고 내 코드입니다 :

  $facebook = new Facebook(array(
       'appId' => 'xxxxxxxxx', 
       'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 
       'cookie' => true, 
      )); 
      $this->facebook=$facebook; 
      $this->session = $facebook->getSession();    
      $this->me = null; 
      // Session based API call. 
      if(!$this->session){ 
       if (!$this->session) { 
      //echo $loginUrl = $facebook->getLoginUrl($par); 
       $loginUrl = $facebook->getLoginUrl(
        array(
        'canvas' => 1, 
        'fbconnect' => 0, 
        'display' => 'page', 
        'req_perms' => 'email,publish_stream,status_update,user_birthday,user_location,user_work_history' 
        )); 
       $this->request->redirect($loginUrl); 
      } 
      } 
      if ($this->session) { 
       try { 
       $this->uid = $facebook->getUser(); 
       $this->user = $facebook->api('/me'); 
       } catch (FacebookApiException $e) { 
       error_log($e); 
       } 
      } 

답변

1

이 loginUrl로 리디렉션하지 않는 , 당신이 기본적으로 당신은 iframe 고토에 페이스 북의 결과로 페이스 북 페이지를 만드는 일을 페이스 북의 iframe. 그리고 페이스 북은 iframe 안에 표시되지 않습니다. 인증 페이지는 표시되지 않습니다.

최상위 리디렉션을 수행해야합니다. 기본적으로 iframe뿐만 아니라 전체 페이지를 리디렉션합니다. iframe 내부에서 최상위 리디렉션을 수행하는 한 가지 방법은 다음 javascript를 표시하는 것입니다.

<html><head> 
    <script type="text/javascript"> 
     window.top.location.href = "<your redirect url here>"; 
    </script> 
    <noscript> 
     <meta http-equiv="refresh" content="0;url=<your redirect url here>" /> 
     <meta http-equiv="window-target" content="_top" /> 
    </noscript> 
    </head></html> 
+0

오늘 시도 할 것이지만 생각했던 것과 매우 유사하므로 제대로 작동해야한다고 생각합니다. – Hafiz

관련 문제