FB.login在移动浏览器中不起作用 [英] FB.login not working in mobile browsers

查看:187
本文介绍了FB.login在移动浏览器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是本机解决方案,只是响应性网站.问题是FB.login根本不执行任何操作. FB.ui方法也是如此.

This is not native solution, just responsive web site.. The problem is, that FB.login simply doesn't do anything. The same goes for FB.ui methods..

我在头上调用fb init(但也尝试在体内获得相同的结果..),如下所示:

i call fb init in head (but also tried in body with same results..) like this:

<script type="text/javascript">
FB.init({ 
    appId: '{$app_id}',
    status: true, 
    cookie: true,
    xfbml: true,
    channelUrl: 'https://www.nottyfly.com/channel.php',
    oauth: true
});

当用户单击fb登录按钮时,代码如下:

When user clicks fb login button, the code is like this:

function fbLogin(){ 
    FB.login(function(response) {
      if (response.authResponse) {
        FB.api('/me/permissions', function (response) {
            var perms = response.data[0];
            document.getElementById("accesstoken").value=FB.getAuthResponse()['accessToken'];
            document.getElementById("korak1").submit();                                          
            } );
      } else {
            alert('{$alert_confirm_app}');
      }
  }, {scope:'email'});  
}

这一切在网页上都很好用,但是在移动浏览器上什么也没产生?

This all work great at web pages, but on mobile browsers produces nothing?

ps.这是演示网页

推荐答案

这是移动浏览器中的常见问题,您会发现它也存在于某些android设备中.

This is common issue among mobile browsers and you will find that it would also be in some android devices.

为预防起见,最佳做法是手动构建登录流程.转到此处 https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow

For precaution it is under best practice to build flow of login manually. Go here https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow

是的,您将需要进行手动集成.但是,毫无疑问,这将是完全可靠的集成.

So yes, you will need to go with manual integration. But, it will be full-proof integration without doubts.

这篇关于FB.login在移动浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆