Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firefox tracking protection blocks async load of facebook js sdk

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.net/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!

like image 364
mmo Avatar asked Nov 19 '15 16:11

mmo


People also ask

Does Firefox really block trackers?

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.

What is tracking protection CDN Firefox?

Tracking Protection is a new platform-level technology that blocks HTTP loads at the network level. It is based on the Safe Browsing technology that powers our phishing and malware protection. This feature was part of the Polaris initiative.

How do I enable cross-site tracking in Firefox?

Select the Privacy & Security panel. Under Enhanced Tracking Protection, select the Custom radio button. Check Cookies and use the drop-down menu to select the types of cookies you wish to block. The default setting is Cross-site tracking cookies — includes social media cookies.


1 Answers

Tracking 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.org/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.

like image 59
David Avatar answered Nov 15 '22 13:11

David