Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic Google Sign-In for Websites code not working in Internet Explorer 11

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.

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").

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."

Here is the sample code:

<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.

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?

like image 521
S. Trencher Avatar asked Jul 01 '15 20:07

S. Trencher


People also ask

Does Google support IE 11?

In order to free up resources to deliver customer-requested features available to modern browsers, Google Maps Platform is ending support for Internet Explorer 11. Microsoft ended support for IE11 in 2021 and encouraged migration to Microsoft Edge.

How do I make my website compatible with Internet Explorer?

To add a site to the Compatibility View list. Open Internet Explorer, select the Tools button , and then select Compatibility View settings. Under Add this website, enter the URL of the site you want to add to the list, and then select Add.

Should your website support Internet Explorer 11?

Our recommendation. Based on analysis, our recommendation is that developers and companies continue to support Internet Explorer 11 for now, until the newer version of Edge (Chromium) can deliver a comparable experience for assistive technologies – especially JAWS, Dragon NaturallySpeaking and Zoomtext.


2 Answers

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

If you look at:

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

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.

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. :)

like image 174
user1251486 Avatar answered Oct 26 '22 23:10

user1251486


Be sure that you don't have IE 11 configured to block all third party cookies.

Third party cookies are required, and the user experience that occurs when third party cookies are blocked--as you've discovered--leaves much to be desired. There is no warning or error message presented to the user.

You could try to catch the error before it happens. It is possible to detect whether or not third party cookies are blocked by trying to set a cookie on a second domain (that you control) and then making a second request to ensure the cookie is set. You'll need a script or something on your server that can set and check for the cookie (it can't be done using only JavaScript because of the browser security model).

like image 35
ccm Avatar answered Oct 27 '22 00:10

ccm