问题
I am attempting to get a hello world google sign-in going. The code below has worked in Chrome and Firefox, but fails to work in Edge or IE 11. It is the most basic example from the official google site.
<!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>
The button is rendered correctly, and when I click on it a new page loads. However, this page (which should show the sign-in stuff) is blank, and is quickly closed. None of the success or failure callbacks are triggered.
来源:https://stackoverflow.com/questions/32576773/google-sign-in-in-internet-explorer-edge