I am loading the facebook js sdk asynchronous in my project with the following code:
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/de_DE/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
this worked fine for me since firefox tracking protection. i noticed that in firefox 42.0 the tracking protection blocks the asynchronous load of the facebook js sdk.
but it seems to be only blocked, when i am not logged in on facebook.
does anyone has an idea how to solve this problem?
many thanks!
I am loading the facebook js sdk asynchronous in my project with the following code:
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/de_DE/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
this worked fine for me since firefox tracking protection. i noticed that in firefox 42.0 the tracking protection blocks the asynchronous load of the facebook js sdk.
but it seems to be only blocked, when i am not logged in on facebook.
does anyone has an idea how to solve this problem?
many thanks!
Share Improve this question asked Nov 19, 2015 at 16:22 mmommo 1539 bronze badges 3- It's 2016 and still no answer? :O For now, I just asked my QA Engineer to turn off tracking protection :D – Muhammad Mobeen Qureshi Commented Feb 8, 2016 at 11:09
- Yep, It seems that the only way is to disable it... – see Commented Apr 8, 2016 at 9:34
- Are you sure it's only Asynchronously loaded scripts, and not external scripts period? – StackSlave Commented May 10, 2016 at 22:58
1 Answer
Reset to default 6Tracking Protection (enabled by default in Firefox 42+) blocks any resources from a pre-defined set of domains while in private browsing mode.
Starting in version 42, Firefox Desktop and Firefox for Android include built-in tracking protection. In Private Browsing windows (tabs, in Firefox for Android), Firefox will block content loaded from domains that track users across sites.
https://developer.mozilla/en-US/Firefox/Privacy/Tracking_Protection
Tracking protection currently uses disconnect.me's basic list by default.
The fact that the script is loaded asynchronously is irrelevant as its the domain that is blacklisted.
Even if you host the JavaScript file yourself, any requests to Facebook domains are also blocked.
So, the only way to allow these requests is to disable tracking protection in the browser.