facebook登录阻止了一个框架问题

注意我阅读了有关此问题的所有相关问题,但我无法找到解决问题的方法。

Facebook登录API HTTPS问题

Facebook:不安全的JavaScript问题(document.domain值应该相同)

我面临被封锁的框架facebook api问题:

Blocked a frame with origin "https://www.facebook.com" from accessing a frame with origin "http://static.ak.facebook.com". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match. 

我按照facebook api教程,我正在使用此代码。

  window.fbAsyncInit = function() { FB.init({ appId : 'appID', status : true, channelUrl : 'http://staging.mywebsite.com/login/channel', cookie : true, xfbml : true }); FB.login(function(response) { if (response.authResponse) { console.log('done'); } else { console.log('problem'); } }); FB.Event.subscribe('auth.login', function(response) { console.log('test reponse'); console.log(response); }); }; (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)); 

/ login / channel包含:

  $cache_expire = 60*60*24*365; header("Pragma: public"); header("Cache-Control: max-age=".$cache_expire); header('Expires: ' . gmdate('D, d MYH:i:s', time()+$cache_expire) . ' GMT'); echo ''; 

fb登录按钮:

   

我也尝试了这个,但它没有解决问题:

  channelUrl : '//staging.mywebsite.com/login/channel', //same issue 

我错过了什么吗? 或者我应该在fb app设置中更改一些内容?

看起来你可能需要修改下面的代码来重温https

 (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 = "https://connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); 

此外,src =“// domain.com将inheritance协议。您可以尝试:

 echo '';