Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox Quantum Private browser not loading scripts added by javascript

I'm trying to accommodate GDPR by not loading our analytics scripts until the user consents.

The way I'm doing it works as expected in every browser we support but FF Quantum's private browsing window. (If it helps, it works as expected in Chrome Incognito)

This is the code that I'm using below:

/**
 * @name loadAnalytics
 * @function
 * @param {boolean} [consented] Determines if the consent click event should be tracked
 */
function loadAnalytics( consented ){
    if( analyticsExists() ) return callbackAnalytics( consented );
    if( !window.analyticsScriptURL ) return;
    var script = document.createElement( 'script' );
    script.src = analyticsScriptURL;
    script.type = 'text/javascript';
    script.async = true;
    script.onload = script.onreadystatechange = callbackAnalytics.bind( this, consented );
    document.head.appendChild( script );
}

Is this a security thing or is there something I'm missing?

like image 535
Dave Maison Avatar asked Oct 17 '22 18:10

Dave Maison


1 Answers

After some research. It seems like the main reason you cannot load the script on the firefox private browser is because of tracking protection that is enabled by default.

You could try to disable it and see whether it happened again or not.

For further reference. Please see this https://support.mozilla.org/en-US/kb/tracking-protection?redirectlocale=en-US&redirectslug=tracking-protection-pbm

like image 144
kucing_terbang Avatar answered Oct 31 '22 11:10

kucing_terbang