Is there a way detecting a window is active or not. Let me explain a little bit more. For example DP window is currently active on my browser, and my webpage is in another tab (or other browser window) and is inactive. I want to detect with a javascript whether my site is currently used by the user or it is on the background
In the example above: The page turns white if focused and gray if blured... <html> <head> <script type="text/javascript"> window.onblur = function () { document.body.style.backgroundColor = "#CCCCCC"; } window.onfocus = function () { document.body.style.backgroundColor = "#FFFFFF"; } </script> </head> <body style="background-color=#FFFFFF"> </body> </html> HTML: