- Open dev tools console.
Exec this code:
window.addEventListener("mousemove", function() { console.log("moved!") });
Activate any another window.
- Move mouse into browser window (but DO NOT put focus in).
- Look in console.
In FF: nothing there.
In Chrome: there is one "moved!" message.
So in inactive window Chrome triggers exactly one mousemove
event when mouse enters window, and then ignores any following movements.
Is this a bug?
And how to manage this? I can detect that mouse has left a browser window, with toElement
prop of mouseout
event. But how to detect whether window is currently active?
My env:
Chrome 46.0.2490.80
Firefox 41.0
MacOS Yosemite 10.10.5