javascript - Is there an event to detect focus and blur on my window/tab -


is there way detect whether user focused page? or possible detect whether page opened not in current tab focused?

read up

globaleventhandlers.onfocus
globaleventhandlers.onblur
window.focus()

javascript

window.onfocus = function() { console.log('yeah, got focus'); } window.onblur = function() { console.log('yeah, lost focus'); } 

demo

try before buy


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -