Eg when you switch to a different app on desktop or mobile, or just view the desktop / home screen. Neither unload
nor pagehide
fire in this situation. visibilitychange
only fires when I switch tabs on desktop.
Javascript:
If you have an element in focus, the onblur()
event will fire.
jQuery:
If you have an element in focus, the focusout()
event will fire.