问题
I was using Facebook login in my website until I received some issues about it not working properly on Firefox. I'm testing on Firefox 55.0.3(64-bit).
To debug it properly, I've create a new blank index page, just like this:
<script>
window.fbAsyncInit = function () {
FB.init({
appId: 'mypersonalID',
cookie: true,
xfbml: true,
version: 'v2.8'
});
FB.AppEvents.logPageView();
};
(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/pt_BR/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function myClick() {
console.log('click');
FB.getLoginStatus(function (response) {
console.log(response);
});
}
</script>
<button onclick="myClick()">Debug</button>
When testing it on Chrome, Edge, Explorer, etc.. The console is printing properly, however, on Firefox, I just see the console click
but never the response from the Facebook event, also, I'm getting no errors at all.
I don't know what may be happening, but this just doesn't work on Firefox.
If I call FB.login() the popup shows up, but on cancel or confirm the login, the view just turns white and never closes or return the promise.
Edit: I tried to run it on Firefox Private mode and now I can see this error:
The feature at "http://connect.facebook.net/en_US/sdk.js" has been blocked because tracing protection is enabled.
Put still don't know how to solve this issue.
回答1:
This is a feature that is unique to Firefox. You can find information on how to disable this feature in private mode here:
https://blog.mozilla.org/futurereleases/2015/09/23/help-test-private-browsing-with-tracking-protection-in-firefox-beta/
You can also read up more on Firefox tracking protection and how it can break websites here:
https://developer.mozilla.org/en-US/Firefox/Privacy/Tracking_Protection
来源:https://stackoverflow.com/questions/46044100/facebook-login-doesnt-work-on-firefox-only