Firefox blocking Facebook Js
Solution 1
From the client side, you can't. This is security policy Firefox. You can read about this issue in thread: https://bugzilla.mozilla.org/show_bug.cgi?id=1226498
Solution 2
A simple google search leads to this page: https://developer.mozilla.org/en-US/Firefox/Privacy/Tracking_Protection
You should be able to deactivate that feature right where the message appears, or via about:config
. It should actually be deactivated by default afaik.
Related videos on Youtube
Peter
Updated on September 14, 2022Comments
-
Peter over 1 year
with upgrade of Firefox to 42.0 I got some strange behavior..
I'm calling FB.init method like this:
FB.init({ appId: '{$appid}', status: true, cookie: true, xfbml: true, oauth: true });
But in Firefox it gets blocked, I get warning:
The resource at "https://connect.facebook.net/en_US/all.js" was blocked because tracking protection is enabled.
This is default behavior, I didn't set up any additional security or whatever..
What to do?
EDIT - after help and googling, this is a little bigger problem:
Turns out Firefox's Do Not Track and tracking protection are two separate things:
Do Not Track is enabled in Preferences/Options > Privacy > "Tell sites that I do not want to be tracked". Enabling sends the DNT header but it does not block any requests.
Tracking Protection is enabled in about:config > privacy.trackingprotection.enabled. Enabling does not send the DNT header, but does block requests based on Disconnect's blocklist. So detecting 2 isn't as easy as checking navigator.doNotTrack, because that property is only set for 1.
Solution (temporarily) - try to do FB.init, if error do some alert..
try { FB.init({ appId: '{$appid}', status: true, cookie: true, xfbml: true, oauth: true }); }catch(err) { alert('Some info for the user...'); }
Does anyone have better solution?
-
Jaromanda X over 8 yearsIs this occuring in a
Private Browsing window
?
-
-
Peter over 8 yearsThank you.. Since i need FB methods for login, how do I deactivate this tracking protection automatically? Via javascript instead of users?
-
andyrandy over 8 yearsit would be weird if it would be possible to deactivate this automatically, dont you think? it would make the whole point of tracking protection pointless...since it should not be activated by default, there should be no problem though.
-
Peter over 8 yearsYes, i agree with this, but your comment made me think this is possible. Since i cant ask user to do this there is no way to use Facebook login - that's like URGh...
-
Peter over 8 yearsWell, I just upgraded Firefox, and it is ON by default (at least for me). And I'm sure many users will just keep it that way. It would be nice to detect this with javascript and give user warning.. I tried "navigator.doNotTrack", but this does not work since this is tracking protection! Still looking for solution to at least detect the "tracking protection"
-
andyrandy over 8 yearswell...upgrading firefox keeps your settings, no surprise there.
-
Elshan over 8 yearsI also done the same thing and it's works for me answer is here stackoverflow.com/a/34243073/1641556
-
Alexander Farber about 4 yearsSometimes the thrid party content is blocked by the corporate IT in Firefox config