Link to home
Start Free TrialLog in
Avatar of OverSurge
OverSurge

asked on

window.open yes, but 'bring to front' of all windows?

Ok.. I'm starting to think this isn't possible but...

I have written a javascript counter that keeps track of how long a user has been idle from using an ASP application I wrote. When the counter reaches 0 the script automatically opens a new window prompting them to either logout or stay active. If they don't respond in 2 minutes it will automatically log them out.

Ok.. now the problem. Everything works fine but the window doesn't open over top of all windows the user has open. Some users are complaining that they don't see it open up on the taskbar and it logs them out when they don't want to be logged out.

I have added a focus() to the window name being called by the opener but it just brings the window into focus and on top of the user is currently viewing the browser window that opened the window.

Is there a way to bring that browser window to the front of all applications running in windows?
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Not really unless you do this;

window.onBlur=focus();

but that means it will stay on top and the user can't access windows until this one is closed.


FtB
Avatar of OverSurge
OverSurge

ASKER

That would be fine with me. It's just a quick ASP page that says continue or not.
But I can't get the opening popup window into focus for the javascript code to take effect. That still requires the prompt window to come into focus on top of the other windows so I can keep there focus on it.
Do the following:

<body onLoad=window.focus()>


That will bring it into focus when the page renders.

FtB
You can use both:

<body onload="window.focus();" onblur="window.focus();">

which will bring focus to the window when it opens, and keep it there until it's closed.
SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well as I said.. I didn't think it would be possible but I needed verification right away so I could tell my boss to tell the users "can't happen". As JakobA stated, I didn't think permission levels of that amount would be good. The points of course would go to the first person who verified all my thoughts for me. Though other suggested using focus() to its limitations, I already recognized this option with it's limitations. fritz_the_blank did first mention that it would still be buried under word, excel, etc, but JakobA stated the exact facts I was looking for in bring truly 'always on top' position and the security and permision limitations. So I'm going to split points between fritz & JakobA. I do thank everyone else for there input.