我使用以下代码在我的项目中加载facebook js sdk异步:
window.fbAsyncInit = function () {
FB.init({
appId: settings.facebookAppId,
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse social plugins on this page
version: 'v2.0' // use version 2.0
});
FB.Canvas.setAutoGrow();
};
// Load the SDK asynchronously
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/de_DE/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
Run Code Online (Sandbox Code Playgroud)
自firefox跟踪保护以来,这对我来说很好.我注意到在firefox 42.0中跟踪保护阻止了facebook js sdk的异步加载.
但它似乎只是被阻止,当我没有登录Facebook.
有没有人知道如何解决这个问题? …