Javascript OAuth2不在IE9上工作
在Chrome/FF中,下面的示例运行良好,但IE9中存在一个问题Javascript OAuth2不在IE9上工作,javascript,jquery,oauth-2.0,google-oauth,Javascript,Jquery,Oauth 2.0,Google Oauth,在Chrome/FF中,下面的示例运行良好,但IE9中存在一个问题 var clientId = 'XXXXXXXXX.apps.googleusercontent.com'; var apiKey = 'XXXXXXXX_XXXXXXXXXXXXXXXh1o'; var scopes = 'https://www.googleapis.com/auth/calendar'; function handleClientLoad() {
var clientId = 'XXXXXXXXX.apps.googleusercontent.com';
var apiKey = 'XXXXXXXX_XXXXXXXXXXXXXXXh1o';
var scopes = 'https://www.googleapis.com/auth/calendar';
function handleClientLoad() {
$(".modal").show();
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuth, 1);
}
function checkAuth() {
gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: true },
handleAuthResult);
}
function handleAuthResult(authResult) {
var authorizeButton = document.getElementById('authorize-button');
if (authResult) {
authorizeButton.style.visibility = 'hidden';
showPanel();
} else {
authorizeButton.style.visibility = '';
authorizeButton.onclick = handleAuthClick;
}
$(".modal").hide();
}
function handleAuthClick(event) {
gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: false }, handleAuthResult);
return false;
}
function showPanel() {
$("div#mainPanel").show("fast");
}
function makeApiCall() {
gapi.client.load('calendar', 'v3', function () {
var request = gapi.client.calendar.events.list({
'calendarId': 'primary'
});
request.execute(function (resp) {
for (var i = 0; i < resp.items.length; i++) {
var li = document.createElement('li');
li.appendChild(document.createTextNode(resp.items[i].summary));
document.getElementById('events').appendChild(li);
}
});
});
}
var clientId='XXXXXXXXX.apps.googleusercontent.com';
变量apiKey='xxxxxxxxx_uxxxxxxxxxxxxxh1o';
var作用域https://www.googleapis.com/auth/calendar';
函数handleClientLoad(){
$(“.modal”).show();
gapi.client.setApiKey(apiKey);
setTimeout(checkAuth,1);
}
函数checkAuth(){
gapi.auth.authorize({client_id:clientId,scope:scopes,immediate:true},
手工(结果);
}
函数handleAuthResult(authResult){
var authorizeButton=document.getElementById('authorized-button');
如果(authResult){
authorizeButton.style.visibility='hidden';
showPanel();
}否则{
authorizeButton.style.visibility='';
authorizeButton.onclick=handleAuthClick;
}
$(“.modal”).hide();
}
函数handleAuthClick(事件){
auth.authorize({client_id:clientId,scope:scopes,immediate:false},handleAuthResult);
返回false;
}
函数showPanel(){
$(“div#mainPanel”).show(“fast”);
}
函数makeApiCall(){
load('calendar','v3',函数(){
var请求=gapi.client.calendar.events.list({
“日历ID”:“主要”
});
请求执行(功能(resp){
对于(变量i=0;i
出于某种原因,authResult
变量在IE9中为空,并且handleAuthClick
click事件弹出一个空白窗口,而不是Google凭证信息
IE9有什么问题?我看到了这篇文章,但答案没有帮助,所以可能是另一个问题…@mfirry,症状是一样的,但不是同一个问题。他们有一个多范围的问题,但这不是我的情况…也许这是一个已知的错误,然后