ng-idle is not working in IE9 and IE10

904 views Asked by At

ng-idle is not working in IE9 and 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/

2

There are 2 answers

0
Lakshmi Narasimhulu Gujjula On BEST ANSWER

Replace

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

with the following code in angular-idle.js

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

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. Write a conditional statement using useragent and use interrupt() method of ng-idle to configure events.

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'); 
        }