我一直在使用来自erichynds.com的idleTimeout jquery插件,它在Firefox和IE中运行良好......但是我在chrome 11.0中使用它时发现了一个奇怪的问题。
我使用javascript“确认”提醒来帮助处理项目的删除。在Chrome中,只要调出“确认”框,就会显示“idleTimeout”对话框,好像用户处于空闲状态且鼠标没有移动....这在我按下确认提示上的其中一个按钮后立即发生。
我尝试使用jquery ui对话框而不是javascript“确认”框并且问题消失了,但是,由于我的要求,我必须使用“同步”确认框,所以我不得不废弃jquery ui对话框。
任何想法如何解决这个问题?提前谢谢。
答案 0 :(得分: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;
}