Facebook API& iPhone优化的登录页面

时间:2012-01-13 01:33:45

标签: iphone facebook mobile-safari

我正在尝试开发一个现有网站的移动版本,以便在iPhone上使用,我正在使用一个直接的超链接,因为这样定义了目标:

  $fb = $this->facebook->getLoginUrl(array(
    'redirect_uri' => $redirect,
    'scope' => 'email,publish_stream,offline_access,friends_location',
    'display' => 'popup'
  ));
  $data['fb_login_url'] = $fb;

然而,在我的iPhone手机游戏中点击这一点,我会看到桌面大小的Facebook登录页面:

enter image description here

如何获得此Facebook登录页面的移动优化版本?

1 个答案:

答案 0 :(得分:1)

如果您需要使用facebook javascript SDK的登录功能,请参阅https://developers.facebook.com/docs/guides/mobile/web/#sdk

具体为this example

FB.login(function(response) {
   if (response.authResponse) {
     console.log('Welcome!  Fetching your information.... ');
     FB.api('/me', function(response) {
       console.log('Good to see you, ' + response.name + '.');
       FB.logout(function(response) {
         console.log('Logged out.');
       });
     });
   } else {
     console.log('User cancelled login or did not fully authorize.');
   }
 }, {scope: 'email'});

致电FB.login()会导致移动网络版在新的移动版“标签”中打开