1

我已经使用此处的文档实现了 Google 一键登录网络,它在桌面 Chrome 上运行良好。但是,即使我已登录 Google 并且该域已列入白名单,它也根本不会出现在 iOS Chrome(版本 87)上。

我该如何解决?

function initialize_google()
{
    google.accounts.id.initialize({
      client_id: "255011972792-vfp8t4dc4js9perda7aq3f2s6ckjr4p8.apps.googleusercontent.com",
      callback: function(credentials) { console.log(credentials) },
      context: 'signin',
      prompt_parent_id: "g_id_onload"
    });
}

function loadScript(url, callback)
{
    console.log('in loadScript with url:' + url);
    // Adding the script tag to the head as suggested before
    var head = document.getElementsByTagName('head')[0];
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = url;

    // Then bind the event to the callback function.
    // There are several events for cross browser compatibility.
    script.onreadystatechange = callback;
    script.onload = callback;

    // Fire the loading
    head.appendChild(script);
}

loadScript("https://accounts.google.com/gsi/client", initialize_google);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<h1>Demo</h1>
<div id='g_id_onload'></div>

4

0 回答 0