我已经写了一个jquery插件,在互联网上提供了一些帮助,它可以从Facebook检索数据,并且在迄今为止除了IE9之外的所有测试浏览器上也是如此。
我为当地政府工作,不幸的是我们仍然在我们的版本中使用IE9
(几周后它仍然是IE8
!!所以我期望的情况可能会更糟糕:)。
无论如何,我离题了,我在IE9
中添加了以下代码部分,但在IE10
和其他浏览器中都没有...
任何人都可以解释/帮助我调整或修复此片段,以便我可以在IE9中使用它吗?并且不要在过程中的任何其他浏览器中破坏它:)??
$.when($.getJSON(ogUSER), $.getJSON(ogPOSTS)).done(function (user, posts) {
// user[0] contains information about the user (name and picture);
// posts[0].data is an array with wall posts;
var fb = {
user: user[0],
posts: []
};
var idxLimit = 0;
$.each(posts[0].data, function () {
// We only show links and statuses from the posts feed:
if (this.type != 'link' && this.type != 'status') {
return true;
}
// Copying the user avatar to each post, so it is
// easier to generate the templates:
this.from.picture = fb.user.picture.data.url;
// Converting the created_time (a UNIX timestamp) to
// a relative time offset (e.g. 5 minutes ago):
this.created_time = relativeTime(this.created_time * 1000);
// Converting URL strings to actual hyperlinks:
this.message = urlHyperlinks(this.message);
//remove all anchors
//var content = $('<div>' + this.message + '</div>');
//content.find('a').remove();
//this.message = content.html();
fb.posts.push(this);
idxLimit++;
if (idxLimit === 2) {
return false;
}
});
在所有浏览器中,不包括IE9,如果我在.done()
回调中的任何位置插入断点,它会停止执行,我可以调试。使用IE9时,未达到断点,导致我认为IE9脚本引擎和jQuery.when()
API调用或.done()
回调方法存在问题......
但是,我只是在猜测...我最近几个小时一直在网上搜索,看看是否有其他人在类似的问题上发生过但无济于事。我希望这里有一些经验丰富的编码员可以提供帮助......我将非常感激。在那之前,搜索继续:)
感谢您的时间;)
PS。在IE9中运行脚本时,我没有收到任何控制台错误...
TartanBono