我做了很多谷歌搜索,但没有找到这个问题的答案。
我已经按照Facebook文档来实现Facebook JS SDK。这是我页面上的代码段
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxxx',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the //session
xfbml : true, // parse XFBML
oauth :true // Enable oauth 2.0
});
FB.Canvas.setAutoResize(); //set size according to iframe content size
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
除了一个文件外,这种方法效果很好: http://static.ak.facebook.com/connect/canvas_proxy.php
all.js 通过HTTPS加载就好了。但Facebook仍然通过常规HTTP加载canvas_proxy.php:
这是为什么?我好像做得对。 HTTPS用户因访问该网址而访问我的网页时会收到安全警告。
答案 0 :(得分:0)
在FB.init调用之前尝试设置FB._https = true。这将照顾canvas_proxy.php。
最初在Facebook JavaScript SDK over HTTPS loading non-secure items
中详述的解决方案