Solved

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

Posted on 2003-11-24
7
3,928 Views
Last Modified: 2011-09-20
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?
0
Comment
Question by:OverSurge
7 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9814196
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
0
 
LVL 1

Author Comment

by:OverSurge
ID: 9814285
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.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9814295
Do the following:

<body onLoad=window.focus()>


That will bring it into focus when the page renders.

FtB
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 11

Expert Comment

by:Zontar
ID: 9814462
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.
0
 
LVL 46

Assisted Solution

by:fritz_the_blank
fritz_the_blank earned 125 total points
ID: 9814479
Which is pretty much what I have....


However it will still be possible for someone to bury the browser under word, outlook, excel and etc.

FtB
0
 
LVL 15

Accepted Solution

by:
JakobA earned 125 total points
ID: 9815543
I am afraid you will have to live with it.  .focus() cannot really put you in a true 'always on top' position, it only puts you on top of other browser windows opened by the current browser invocation.

How would you like it if you, while busy beawering away at Word, looked up to see that god knows how much of your work had been intercepted by a strange window that suddenly started stealing your keyboard input?

You need some really heavy privilidges to do that. And even if you have the priviledge, think twice.

regards JakobA
0
 
LVL 1

Author Comment

by:OverSurge
ID: 9817526
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.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question