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
Comments
Post a Comment