简体   繁体   中英

FB.login popup no longer working on Safari mac?

Anyone else no longer getting popups in Safari?

Here's some sample code that does not work in Safari. It is launched by a click on link so the popup blocker shouldn't block it. Any ideas why it does?

Online example here:

http://users.telenet.be/prullen/fbtest.html

Note that this will not run through the expected behavior since it's on another domain and has an incorrect app ID. But the only thing that matters for this example is the showing of the popup.

<script type="text/javascript">
var fbLoaded = false;
var doReLogin = true;

function createAccessToken(){   
if (!fbLoaded) {
    FB.init({
    appId      : 'xxx', // App ID
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
    });
}

fbLoaded = true;

FB.getLoginStatus(function(response) {      
    if (response.status === 'connected') {
        getExtendedAccessToken(response.authResponse);
    } else {
        FB.login(function(response) {
            if (response.status == 'connected') {
                if (response.authResponse && response.authResponse.accessToken) {
                    getExtendedAccessToken(response.authResponse);
                } else {
                    alert('You cancelled login or did not fully authorize.');
                }
            } else {
                alert('To use you have to create an access token.');
            }
        }, {scope: 'read_stream'});
    }
 }, true);
}

function getExtendedAccessToken() {
}
</script>

<p style="text-align:center;"><a href="#" onclick="createAccessToken();return false;" class="connect">Connect With FaceBook</a></p>

Can you check your settings regarding blocking pop-up window? This issue: Facebook Login not open in Safari/ iPhone the same as you have, I guess.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM