2

我们正在与 Linked IN 集成以提取用户配置文件。它工作正常,但我们注意到在一些 Windows 7 / IE 9 机器中,Linked IN 弹出窗口出现并且是空白的。我们在控制台中看到以下错误。

消息:对象不支持属性或方法“替换”行:861 字符:17 代码:0 URI:http ://platform.linkedin.com/js/framework?v=0.0.2000-RC1.21420-1403&lang= zh_CN

下面的代码片段

<script type="text/javascript" src="https://platform.linkedin.com/in.js?async=false" >
  api_key: tw6oqfav7ms1
  authorize:false  
</script> 

//We have a custom image for linkedIN, onclick of the same below code is called.
$("#mylinkedin").click(function () {
  IN.UI.Authorize().params({"scope":["r_fullprofile", "r_emailaddress","r_contactinfo"]}).place();
  IN.Event.on(IN, "auth", onLinkedInAuth);
});

function onLinkedInAuth() {    
    IN.API.Profile("me").fields([ "id","firstName", "location","lastName","skills","positions","educations","languages","phone-numbers","certifications","emailAddress","mainAddress"]).result(displayProfiles);
    IN.User.logout(); //After we take the data, we do a log out
    $.get("https://api.linkedin.com/uas/oauth/invalidateToken");
}

function displayProfiles(profiles) {
 //Access profile and process
 member = profiles.values[0]
 ...........
}
4

2 回答 2

2

感谢您的回复。我能够自己解决这个问题。我们观察到的是在Win7 的IE9 机器上,Linked IN 授权Pop Up 是空白的。当我取消选中“启用保护模式”时,弹出窗口没有任何问题。

于 2012-10-22T12:19:56.947 回答
0

我没有机会对此进行测试,但对我来说,您似乎在代码中引入了竞争条件,特别是在onLinkedInAuth().

调用调用了对 LinkedIn 的异步调用,该调用在代码IN.API.Profile()中的 JavaScript 引擎时可能尚未完成。IN.User.logout()

我会将代码更改为以下内容,看看是否可以解决问题:

IN.API.Profile("me")
  .fields([ "id","firstName", "location","lastName","skills","positions","educations","languages","phone-numbers","certifications","emailAddress","mainAddress"])
  .result(function(profile) {
    displayProfiles(profile);
    IN.User.logout(); //After we take the data, we do a log out
    $.get("https://api.linkedin.com/uas/oauth/invalidateToken");
  });
于 2012-10-19T19:30:06.360 回答