2014-09-02 51 views
2

如果我嘗試使用Firebase從Firefox中的彈出窗口進行簡單登錄,彈出窗口會自動關閉,並且我從不登錄。如果新窗口不是彈出窗口,則一切正常。如果它只是另一個選項卡)。無論新窗口是否爲彈出窗口,在Chrome中一切正常。Firebase彈出窗口在調用登錄後關閉

這是我的第一個HTML文件:

<script> 

function chromeless() { 
    var s = "width=" + 1200 + ",height=" + 200 
    var win = window.open('http://localhost:5000/tests/login.html',null,s,true) 
    return win 
} 

</script> 

<a href="#" onclick="chromeless()">Launch app</a> 

這裏的login.html:

<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'> 
</script> 
<script src='https://cdn.firebase.com/v0/firebase.js'></script> 
<script src="https://cdn.firebase.com/js/simple-login/1.6.1/firebase-simple-login.js"></script> 

<button id="login-github" style="display: none">Log in with GitHub</button> 

<script> 

var ref = new Firebase('https://taskranger.firebaseio.com/') 
var auth = new FirebaseSimpleLogin(ref, function(err, user) { 
    if(err) 
    alert(err) 
    else if(user) 
    console.log('logged in:', user) 
    else 
    $('#login-github').show() 
}) 

$('#login-github').click(function() { auth.login('github', { rememberMe: true }) }) 
</script> 

回答

2

您可以在您的index.html命名您的彈出窗口解決此問題:

<script> 

function chromeless() { 
    var s = "width=" + 1200 + ",height=" + 200 
    var win = window.open('./login.html',"any_valid_window_name",s,true) 
    return win 
} 

</script> 

<a href="#" onclick="chromeless()">Launch app</a>