用于网站代码的基本Google登录代码无法在Internet Explorer 11中使用

问题描述:

我正在尝试使用Google登录网站( https:// developers.google.com/identity/sign-in/web/ )并注意到我的解决方案无法在Internet Explorer 11中运行。为了尝试消除尽可能多的因素,我创建了一个基于的简单测试用例Google提供的示例代码。

I am attempting to use Google Sign-In for Websites (https://developers.google.com/identity/sign-in/web/) and noticed that my solution is not working in Internet Explorer 11. To try to eliminate as many factors as possible, I created a simple test case based on the sample code provided by Google.

我已经在我的Windows 7 PC上的Chrome,Mac上的Chrome,Mac上的Safari,Mac上的Firefox和iPhone上的Safari上测试了它。它适用于所有这些(例如,当我点击登录按钮并选择/输入我的Google帐户时,它返回到页面,按钮显示,登录)。

I've tested it in Chrome on my Windows 7 PC, Chrome on my Mac, Safari on my Mac, Firefox on my Mac and Safari on my iPhone. It works on all of these (e.g., when I click the sign in button and select/enter my Google account, it returns to the page and the button says, "Signed in").

然而,它不适用于PC上的Internet Explorer 11,或者奇怪的是,Chrome for iOS。单击该按钮后,将打开一个窗口以允许我选择我的Google帐户,但在进行选择后,窗口将关闭并返回到页面,其中仍有一个按钮仍然显示登录。

It does not, however, work on Internet Explorer 11 on PC or, strangely enough, Chrome for iOS. When the button is clicked, a window opens to allow me to select my Google account, but after making a selection, the window closes and returns to the page with a button that still says, "Sign In."

以下是示例代码:

<html>
<head>
<meta name="google-signin-client_id" content="61023618497-vqfbod57f26ncjl9d6firk3t09ve4tt3.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
</head>
<body>
<div class="g-signin2"></div>
</body>
</html>

关于可能发生的事情的任何想法?我一直在搜索并找不到任何解决方案。

Any ideas as to what might be going on? I've searched around and have not found any solutions.

一个想法是将accounts.google.com添加到IE的可信站点。这没用。我也尝试通过https而不是http来访问该页面。这也没有什么不同。还有什么我应该尝试的吗?

One idea was to add "accounts.google.com" to IE's Trusted Sites. This didn't work. I also tried accessing the page via https instead of http. That didn't make a difference either. Anything else I should try?

几个月后我遇到了同样的问题。

I ran into the same problem now, a few months later.

如果你看看:

https://developers.google.com/identity/sign-in/web/build-button

并尝试使用他们的演示按钮登录,它不适用于IE11(但它适用于我在不同操作系统使用的其他浏览器)。我找不到任何解决方案。

and try a signin with their demo button, it does not work with IE11 (but it works with other browsers I am using at different OS). I could not find any solution.

我将留下未来读者的评论,他将来会搜索同样的问题。如果Google上的演示按钮不起作用,她至少可以放心,问题可能不在她的代码中。 :)

I am leaving the comment for a future reader, who searches for the same problem in the future. If the demo button at Google does not work, she can at least rest assured that the problem is probably not in her code. :)