View Full Version : making a popup "always" on top

03-18-2004, 09:11 PM
What parameter would I pass (for IE) to keep a pop-up
always on top?

03-18-2004, 09:15 PM
In the body line of the popup window add:

03-18-2004, 09:24 PM
Hmm. Didn't give an error, but didn't keep it on top either.

<TITLE>Check Full Name</TITLE>
<BODY onBlur='self.focus();'>

is how the pop-up starts....

03-18-2004, 09:30 PM
try window.focus(); instead ;)

03-18-2004, 09:37 PM
no. still won't stay on top.

Here's the problem

The parent page spawns off a small pop-up,
if someone accidentally clicks anywhere outside the popup
window, the parent window becomes focused.

and you have to click on the toolbar at the bottom to
refocus the pop-up window.

I thought there was a parameter you could pass when you
open the window that would keep it on top...


03-19-2004, 05:41 AM
If your target browser is IE only, you can use Modal or Modeless dialog boxes (http://www.webreference.com/js/column90/).
Mozilla also has modal window. - http://www.codingforums.com/showthread.php?s=&threadid=30267
In that link, there's a post that linked to a simulated modal windows that work cross-browser.

03-19-2004, 05:45 AM
You could try continually setting focus:

<body onload="setInterval(window.focus()',200)">

03-19-2004, 05:49 AM
John's solution should work fine (assuming you correct the slight syntax error) though there isn't really a need to continually request focus. Listening for an onblur event and then waiting a small amount of time before requesting focus should do the job. See: http://www.webdevfaqs.com/javascript.php#altpopupfocus.

03-19-2004, 05:55 AM
That would be annoying because you can't focus to other opened applications. You only bring the focus back to the popup if the focus is currently in the parent window not in other applications. I think that's what the author did in the link that I mentioned in my previous post.

03-19-2004, 05:59 AM
Good point Glenn. The most practical solution would likely be to check if it's IE, if so, use showModalDialog; if Mozilla, use openDialog. Though, it would be nice if there was some kind of universal method or parameter that could be used&hellip;