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

Posted on 2003-11-24
Medium Priority
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?
Question by:OverSurge
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 46

Expert Comment

ID: 9814196
Not really unless you do this;


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


Author Comment

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.
LVL 46

Expert Comment

ID: 9814295
Do the following:

<body onLoad=window.focus()>

That will bring it into focus when the page renders.


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 11

Expert Comment

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.
LVL 46

Assisted Solution

fritz_the_blank earned 500 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.

LVL 15

Accepted Solution

JakobA earned 500 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

Author Comment

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.

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…
Suggested Courses

752 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