aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Bringing popup window to foreground Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Bringing popup window to foreground" Watch "Bringing popup window to foreground" New topic
Author

Bringing popup window to foreground

Ravi Majety
Ranch Hand

Joined: Feb 26, 2009
Posts: 59

Hi,

i had written a javascript code in my application , if the user is idle for 5 mintues then it opens a warning window where the user will be informed that session will be expired in another 4 mintues. The issue is as follows

1. The user opens the my web application in the browser.
2. minimizes the browser and works on excel or notepad or any other application.
3. As the user is not operating on my web application, after 5 idle mintues a popup will be opened with session warning message.
4. Here as the focus is on another application other than browser the popup is not coming to foreground, it just getting blinked in the taskbar.

So i need to bring the popup window to foreground , so that user will get noticed and saves his work in my application.

I tried using the focus method on popup window ,but still facing the same issue....


Please suggest me the best approach way. .....
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

You can't. If the browser doesn't have focus, you can't bring it to the front. That is for the user's protection. If I went to a webpage that could constantly interrupt other apps, that would be bad.

What you can do it popup and alert. In some browsers/operating systems, this will cause the window to blink or get the user's attention. It will not bring your peop up to the front either though.

Also, 5 minutes seems like a very short timeout.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ravi Majety
Ranch Hand

Joined: Feb 26, 2009
Posts: 59

Hi Jeanne

Jeanne Boyarsky wrote:Also, 5 minutes seems like a very short timeout.


I had given 5 mintues as an example. Here we are configuring session Timeout as 60 mins. So Warning window would display after 55 idle minutes.

Jeanne Boyarsky wrote:
You can't. If the browser doesn't have focus, you can't bring it to the front. That is for the user's protection. If I went to a webpage that could constantly interrupt other apps, that would be bad.


What you mentioned is absolutely right. It looks good for some public websites,but here the user is expecting the immediate attention .

In C# i had come across a function SetForegroundWindow which forces the window to move to foreground. Are we not having similar functions in javscript?


Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It does not matter if it is internal, you can not make a browser act like a client app.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60991
    
  65

And thank goodness. Can you imagine the nightmare of windows popping themselves to the front constantly?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bringing popup window to foreground