我使用服务器端身份验证设置了“使用Google登录”按钮。一切适用于Chrome,FIrefox,Safari。在IE 11/Edge中,Google登录窗口打开,登录是正确的,但当弹出窗口关闭时什么也没有发生。回调函数永远不会被调用。控制台没有什么 我认为这是Google Sign-in in Internet Explorer/Edge 相同的问题在我的情况,就像在其他线程中,代码是谷歌示例相同。使用谷歌按钮在Internet Explorer 11/Edge中登录
<script type="text/javascript">
function signInCallback(authResult){
if (authResult['code']) {
$('#login_social').html("");
setLoading($('#login_social'),'relative');
$.ajax({
url:'gp_ajax_server_login?state=d77e966cf2e830268a4223543a853dd9',
type: 'POST',
contentType: 'application/octet-stream; charset=utf-8',
success: function(response){
if(response == "OK"){
displayLoggedUser();
}else if(response == "CL"){
window.location.href = "/snkt/";
}
},
data: authResult['code'],
processData: false
});
}else{
console.log("GOOGLE SIGN-IN ERROR");
}
}
function startAndRender(){
gapi.load('auth2', function() {
auth2 = gapi.auth2.init(
{client_id:'XXXXXXXXX.apps.googleusercontent.com'}
);
});
}
</script>
<script src="https://apis.google.com/js/client:platform.js?onload=startAndRender" async defer></script>
<center>
<button id="signinButton" class="g-signin-btn"></button>
<script>
$('#signinButton').click(function(){
auth2.grantOfflineAccess({'redirect_uri':'postmessage'}).then(signInCallback);
});
</script>
</center>
的可能的复制[谷歌登录的Web应用程序无法使用Internet Explorer的工作(http://stackoverflow.com/questions/31494204/google-sign-in-for-web-apps-not-working -with-互联网浏览器) – bummi