简体   繁体   English

ng-idle在IE9和IE10中不起作用

[英]ng-idle is not working in IE9 and IE10

ng-idle is not working in IE9 and IE10. ng-idle在IE9和IE10中不起作用。 Suppose if you leave the mouse pointer on the page, it is not considering as the user is inactive. 假设您将鼠标指针放在页面上,则不会考虑用户处于非活动状态。 When you keep the mouse pointer is outside of the page it is working. 当你保持鼠标指针位于页面之外时,它正在工作。

Please provide solution for this. 请为此提供解决方案。

Use following url to check http://hackedbychinese.github.io/ng-idle/ 使用以下网址查看http://hackedbychinese.github.io/ng-idle/

Replace 更换

$document.find('body').on(options.interrupt, function(event) {
    svc.interrupt();
}

with the following code in angular-idle.js 使用angular-idle.js中的以下代码

$document.find('body').on(options.interrupt, function(event) {
    if (event.type !== 'mousemove' || (event.movementX || event.movementY)) {
        svc.interrupt();
    }
});

It seems the issue is with the mousemove event, the quick fix for it can be the removal of mousemove event for the IE browser. 似乎问题在于mousemove事件,它的快速修复可以是删除IE浏览器的mousemove事件。 Write a conditional statement using useragent and use interrupt() method of ng-idle to configure events. 使用useragent编写条件语句并使用ng-idle interrupt()方法来配置事件。

if (navigator.userAgent.toLowerCase().indexOf("msie") > 0) {
            // Code for Internet Explorer because ng-idle doesn't stop listening mousemove event.
            IdleProvider.interrupt('keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll'); 
        }
        else {
            IdleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll'); 
        } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM