Solved

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

Posted on 2003-11-24
7
3,924 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now