移动Safari Facebook登录重定向问题 - Javascript SDK

时间:2012-12-03 03:21:35

标签: facebook facebook-graph-api safari facebook-javascript-sdk mobile-safari

Javascript SDK适用于我桌面上的每个浏览器,但我在iPhone上遇到Safari问题。

以下是发生的事情:   - 我点击登录   - Facebook Oauth在新窗口中打开,我成功登录   - Facebook Oauth窗口关闭,旧窗口出现   - 而不是刷新登录页面(如桌面浏览器那样),没有任何反应......

所以我已成功登录,但旧页面显示出来。用户认为他们没有登录。我已经看到类似的问题儿子堆栈溢出但没有答案。

有没有人看过这个或知道解决方案?

 <html xmlns:fb="http://ogp.me/ns/fb#">
  <body>
  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : <%= FACEBOOK_CONFIG['app_id'] %>, // App ID
        channelUrl : '//'+window.location.hostname+'/channel', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true  // parse XFBML
      });
      // Additional initialization code here
      // whenever the user logs in, we refresh the page

      FB.Event.subscribe('auth.login', function() {
        setTimeout('document.location.reload()', 10);
      });

    };


    // Load the SDK Asynchronously
    (function(d){
       var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
       if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       ref.parentNode.insertBefore(js, ref);
     }(document));
  </script> 

0 个答案:

没有答案