2015-01-27 96 views
3

首先,此代码适用于除IE 10以外的所有浏览器。我只是想使用Google Sign Up Javascript SDK来让用户注册网站。下面是代码:谷歌在Internet Explorer中注册不起作用

function SignInCallback(authResult) { 
    if (authResult['status']['signed_in']) { 
     gapi.client.load('plus', 'v1', apiClientLoaded); 
    } else { 
     // "immediate_failed" - Could not automatically log in the user 
    } 
} 

function apiClientLoaded() { 
    gapi.client.plus.people.get({ 
     userId: 'me' 
    }).execute(handleEmailResponse); 
} 

function handleEmailResponse(resp) { 
    var s = resp.emails[0].value; 
} 

如可以从代码中可以看出,回调函数是SignInCallback。然后调用apiClientLoaded,然后将用户详细信息的响应传递给handleEmailResponse。但在IE中,当我尝试评估resp.emails[0].value;时,出现以下错误:SCRIPT5007: Unable to get property '0' of undefined or null reference。如前所述,由于某种原因,除了IE 10以外,其他所有浏览器都可以使用此功能任何想法为什么?

+0

是在兼容模式下的页面呈现? – 2015-01-27 07:16:56

+0

它没有在兼容模式下运行,因为当这种情况发生时,它会从字面上抱怨一切......感叹 – user481610 2015-01-27 10:09:57

回答

0

尝试setting the document mode to IE 8 standards为您的网页:

<!-- Use IE 8 Standards mode --> 
<meta http-equiv="x-ua-compatible" content="IE=8" /> 

你甚至可能要强制IE模仿版本8,更具体的做法:

<!-- Use Emulated IE 8 Standards mode --> 
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8" /> 
相关问题