使用javascript API的Google Oauth2登录不适用于IE
我正在使用google oauth2 javascript api对我的应用程序的用户进行身份验证。这在Firefox和chrome中运行良好,但在IE中不行。我在IE 8、9和10中尝试过,但都没有成功。我在网上搜索了很多,但没有找到任何解决办法。我已经讨论了stackoverflow的问题和。如果这是谷歌现有的一个bug,那么有没有其他的解决方法呢?我正在尝试下面的代码。 我没有足够的分数来评论任何问题,所以问一个新问题。请帮忙 这是我的密码使用javascript API的Google Oauth2登录不适用于IE,javascript,internet-explorer,google-oauth,google-oauth-java-client,Javascript,Internet Explorer,Google Oauth,Google Oauth Java Client,我正在使用google oauth2 javascript api对我的应用程序的用户进行身份验证。这在Firefox和chrome中运行良好,但在IE中不行。我在IE 8、9和10中尝试过,但都没有成功。我在网上搜索了很多,但没有找到任何解决办法。我已经讨论了stackoverflow的问题和。如果这是谷歌现有的一个bug,那么有没有其他的解决方法呢?我正在尝试下面的代码。 我没有足够的分数来评论任何问题,所以问一个新问题。请帮忙 这是我的密码 <html> <he
<html>
<head>
<script type="text/javascript">
window.setTimeout(function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
},1000)();
function signinCallback(authResult) {
if (authResult['access_token']) {
document.getElementById('signinButton').setAttribute('style', 'display: none');
}
else if (authResult['error']) {
console.log('Sign-in state: ' + authResult['error']);
}
}
</script>
</head>
<body>
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="my clinetid"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile">
</span>
</span>
</body>
</html>
setTimeout(函数(){
var po=document.createElement('script');
po.type='text/javascript';po.async=true;
po.src=https://apis.google.com/js/client:plusone.js';
var s=document.getElementsByTagName('script')[0];
s、 parentNode.insertBefore(po,s);
},1000)();
函数signinCallback(authResult){
如果(authResult['access_token']){
document.getElementById('signinButton').setAttribute('style','display:none');
}
如果(authResult['error']){
log('登录状态:'+authResult['error']);
}
}
试试这个
<html>
<head>
<script type="text/javascript">
function signinCallback(authResult) {
if (authResult['access_token']) {
document.getElementById('signinButton').setAttribute('style', 'display: none');
}
else if (authResult['error']) {
console.log('Sign-in state: ' + authResult['error']);
}
}
</script>
</head>
<body>
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="my clinetid"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile">
</span>
</span>
<script type="text/javascript">
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
</script>
</body>
</html>
函数signinCallback(authResult){
如果(authResult['access_token']){
document.getElementById('signinButton').setAttribute('style','display:none');
}
如果(authResult['error']){
log('登录状态:'+authResult['error']);
}
}
var po=document.createElement('script');
po.type='text/javascript';po.async=true;
po.src=https://apis.google.com/js/client:plusone.js';
var s=document.getElementsByTagName('script')[0];
s、 parentNode.insertBefore(po,s);
如果可能,请提供一些详细信息。您做了哪些更改?很难比较代码