In a nutshell; I wrote a simplified chat application for me and me. When there is no focus in the window on which the application is running (minimized or behind other windows) and a message appears, I want to change the title bar of the windows to serve as an alert. Just like the Google chat app in GMail.
Everything works flawlessly in Firefox and Chrome, but not in IE7 (8 not tested).
This is the code that I use to determine if focus has focus. Could it be written differently to work in IE? In addition, I am open to any other approaches to achieve the same. Thank you very much in advance.
$(window).bind("blur", function() { hasfocus = false; }); $(window).bind("focus", function() { hasfocus = true; });
source share