I have a Google sign-in on my site, which (after checking the token) redirects the user. It works exactly as desired on Chrome, but the redirect does not happen on either Internet Explorer or Edge, instead it just stays on the sign-in page.
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
var id_token = googleUser.getAuthResponse().id_token;
var userid;
$.get("https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=" + id_token, function( data ) {
window.location = 'check.php?userid=' + data.sub; // Once Google login is complete, redirects to check.php, sending userid via GET
}, "json" );
}
</script>
Any ideas about what's stopping it from working on IE? My hunch is that it's to do with the window.location line, but I'm not good enough with javascript or understanding IE to figure out what!
The site is at http://test.cowenphysics.com.
Thanks
Edit: Looking at this similar question, it seems the problem is not due to my redirect, but the Google sign-in itself. That makes sense, as the sign-in button doesn't change state after sign-in. Basic Google Sign-In for Websites code not working in Internet Explorer 11
Edit 2: This does seem to be a bug at Google or IE's end. Even the official Google developer site with instructions on implementing sign-in does not work on Internet Explorer. Try the sign-in button on this page: https://developers.google.com/identity/sign-in/web/build-button