Facebook login doesn't work on Firefox only

孤者浪人 提交于 2020-05-29 07:18:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!