如何在移动设备上使用Facebook API?

C. *_*ppa 8 javascript facebook

这一点文档并没有你想象的那么有用.我知道我必须在URL的末尾挂一个显示参数,但我不知道如何调用这样的登录窗口.这就是我现在拥有的:

<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
<script type="text/javascript">
  // initialize the library with the API key
  FB.init({ apiKey: '{{ facebook_api_key }}', status: true, cookie: true, xfbml: true});

  function facebookConnect(form){
      function handleResponse(response){
          form.submit();
      }
      FB.login(handleResponse,{perms:'publish_stream,user_about_me,status_update,email,offline_access'});
  }

</script>
Run Code Online (Sandbox Code Playgroud)

这在桌面浏览器中工作正常,但我无法弄清楚如何获得对话框的"触摸"或"wap"模式.

我正在使用django-socialregistration,如果它有任何相关性.

pra*_*eek 1

为什么要将响应处理程序包装在函数内?

做类似的事情:

function handleStatusChange(response) {
  if (response.authResponse) {
    console.log(response);
  }
}

window.fbAsyncInit = function() {
  FB.init({ appId: 'YOUR_APP_ID', 
    status: true, 
    cookie: true,
    xfbml: true,
    oauth: true
  });

  FB.Event.subscribe('auth.statusChange', handleStatusChange);  
};
Run Code Online (Sandbox Code Playgroud)

取自https://developers.facebook.com/docs/guides/mobile/web/