1

我一直在使用来自erichynds.com的 idleTimeout jquery 插件,它在 Firefox 和 IE 中运行良好……但是在 chrome 11.0 中使用它时发现了一个奇怪的问题。

我使用 javascript“确认”警报来帮助处理项目的删除。在 Chrome 中,只要“确认”框被称为“idleTimeout”对话框就会出现,就好像用户处于空闲状态并且鼠标没有移动......这会在我按下确认提示中的一个按钮后立即发生。

我尝试使用 jquery ui 对话框而不是 javascript“确认”框,问题消失了,但是,由于我的要求,我必须使用“同步”确认框,所以我不得不废弃 jquery ui 对话框盒子。

任何想法如何解决这个问题?提前致谢。

4

1 回答 1

1

在此链接上找到了解决方案,大约是另一个用户为遇到此问题的其他人发布此修复程序的一半。

关联


No idea why Chrome alert/confirm causes idle to be triggered, but here is my work-around. In jquery.idletimer.js, the toggleSTate function, replace the the "// reset timeout counter" with:

// reset timeout counter
var elapsed = (+new Date) - f.olddate;
f.olddate = +new Date;

// handle Chrome always triggering idle after js alert or comfirm popup
if (idle && (elapsed < timeout)) {
idle = false;
clearTimeout($.idleTimer.tId);
if (enabled)
$.idleTimer.tId = setTimeout(toggleIdleState, timeout);
return;
}
于 2011-05-18T20:45:59.273 回答