Uğurcan Şengit
Uğurcan Şengit

Reputation: 1026

Is there any way to bring a popup front with javascript?

I am writing a web application and I open some popup windows with respect to user events.

Now I want to avoid from having too many opened popups, so I decided to bring already opened popup front instead of pop a new one.

In my researches I saw that there was a method called window.focus in old browsers like before Chrome 20 or so, but this method is no longer available because of over usage for advertisement.

Is there any solid way or even workaround to bring an already opened up popup front in javascript?

Thanks, Ugurcan

Upvotes: 2

Views: 665

Answers (2)

Uğurcan Şengit
Uğurcan Şengit

Reputation: 1026

I came up with a workaround for Chrome. In javascript, when you use window.alert method, Chrome brings according window to the front, but this is not applicible for Firefox and IE. I will use this workaround for now. Only problem here is that, one does not simply decorate window.alert pop-up box.

Upvotes: 1

Suman Barick
Suman Barick

Reputation: 3411

We can just use css z-index to bring it at front and z-index is supported in effectively all browsers (since IE6+, Firefox 2+, Chrome 1+ etc) as per caniuse.com

Upvotes: 0

Related Questions