You can use a timer to call self.focus() for this, that is triggered whenever the window loses focus by detecting the onblur event. Add onBlur=”setTimeout(‘self.focus()’,500)” to the window’s body tag, like this:

<body onBlur=”setTimeout(‘self.focus()’,500)”>

The 500 is the time interval, in milliseconds. (1000 milliseconds is 1 second). Usually a range of 300-7000 will keep the window comfortably in front. Unlike a simple onblur=”self.focus();” the window does not behave modally.

via – JavaScript – Bring Window To Front Periodically.