Javascript 在Internet Explorer/Edge中使用Google登录
我正在尝试获得一个hello world google登录。下面的代码已经在Chrome和Firefox中运行,但在Edge或IE11中无法运行。它来自谷歌官方网站Javascript 在Internet Explorer/Edge中使用Google登录,javascript,google-signin,Javascript,Google Signin,我正在尝试获得一个hello world google登录。下面的代码已经在Chrome和Firefox中运行,但在Edge或IE11中无法运行。它来自谷歌官方网站 <!DOCTYPE html> <html> <head> <meta name="google-signin-client_id" content="533332380921-7m8eoi4968kvl1mmr0kk3clco25loemg.apps.googleusercontent
<!DOCTYPE html>
<html>
<head>
<meta name="google-signin-client_id" content="533332380921-7m8eoi4968kvl1mmr0kk3clco25loemg.apps.googleusercontent.com">
</head>
<body>
<div id="my-signin2"></div>
<script>
function onSuccess(googleUser) {
console.log('Logged in as: ' + googleUser.getBasicProfile().getName());
}
function onFailure(error) {
console.log(error);
}
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'https://www.googleapis.com/auth/plus.login',
'width': 200,
'height': 50,
'longtitle': true,
'theme': 'dark',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
</script>
<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
</body>
</html>
函数onSuccess(谷歌用户){
log('登录身份:'+googleUser.getBasicProfile().getName());
}
功能失效(错误){
console.log(错误);
}
函数renderButton(){
gapi.signn2.render('my-signn2'{
'范围':'https://www.googleapis.com/auth/plus.login',
“宽度”:200,
身高:50,,
"龙缇乐":对,,
“主题”:“黑暗”,
“onsuccess”:onsuccess,
“onfailure”:onfailure
});
}
该按钮被正确呈现,当我单击它时,将加载一个新页面。但是,这个页面(应该显示登录内容)是空白的,并且很快就会关闭。没有触发任何成功或失败的回调。控制台日志中有任何内容吗?没有异常。的可能重复(目前也没有响应)