Authentication 如何以编程方式关闭google一键登录iframe?

Authentication 如何以编程方式关闭google一键登录iframe?,authentication,iframe,yolo,programmatically,Authentication,Iframe,Yolo,Programmatically,我有一个使用谷歌一键登录的登录表单。我正在angular中开发此功能。所以当我进入登录页面时,googleone-tap-loginiframe将加载到页面中。但当我移动到另一个页面时,实际的问题就出现了,我的谷歌一键登录iframe保持在页面的一角 我已经尝试使用jquery删除iframe,但是在这个场景中,iframe被成功删除,但是当登录页面通过从一个页面到另一个页面的导航再次加载时,iframe不会再次显示 所以我认为,如果我务实地触发iframe close按钮的close事件,那么

我有一个使用谷歌一键登录的登录表单。我正在angular中开发此功能。所以当我进入登录页面时,googleone-tap-loginiframe将加载到页面中。但当我移动到另一个页面时,实际的问题就出现了,我的谷歌一键登录iframe保持在页面的一角

我已经尝试使用jquery删除iframe,但是在这个场景中,iframe被成功删除,但是当登录页面通过从一个页面到另一个页面的导航再次加载时,iframe不会再次显示

所以我认为,如果我务实地触发iframe close按钮的close事件,那么我的问题就解决了。但我找不到任何官方文件。为了它


有什么方法可以实用地关闭iframe吗?

这是我在更多的谷歌搜索后找到的答案

Delcare it first on组件:

declare const googleyolo: any;
我将iframe添加到登录表单中,如下所示:

    const hintPromise = googleyolo.hint({
      supportedAuthMethods: [
        "https://accounts.google.com"
      ],
      supportedIdTokenProviders: [
        {
          uri: "https://accounts.google.com",
          clientId: "Your google yolo client id"
        }
      ]
    }).then((credential) => {
          // automatically Call this function after click on one account
      }
    }, (error) => {
      console.log('error', error);
    });

    const bodyObserver = new MutationObserver(mutationsList => {
      mutationsList.forEach((mutation: any) => {
        mutation.addedNodes.forEach((node: any) => {
          if (node.nodeName === 'IFRAME' && node.src.includes('smartlock.google.com/iframe/')) {
            bodyObserver.disconnect();
            node.classList.add('google-inserted-frame');
            node.setAttribute('id', 'googleYoloIframe');
          }
        });
      });
    });
    bodyObserver.observe(window.document.body, {
      childList: true
    });
  }
以下是我对IFrame的看法:

var iframe = $('#googleYoloIframe');
if(iframe.length > 0){
  googleyolo.cancelLastOperation();
}

你找到解决这个问题的办法了吗。我和安格拉有同样的问题是的,我发现了。让我补充一下这个解决方案。