Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bringing popup window to foreground

 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And thank goodness. Can you imagine the nightmare of windows popping themselves to the front constantly?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic