Google Sign-in in Internet Explorer / Edge

风流意气都作罢 提交于 2020-01-02 22:03:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!