Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to focus window/tab like alert()?

Tags:

javascript

If in some of my tabs alert() is executed, then this tab becomes selected instantly. The thing is - this alert() box is ugly. I have created with my design and all.. But when I call it - tab is not selected/focused. window.focus(); does not work. Any ideas?

like image 879
user338418 Avatar asked Aug 06 '10 11:08

user338418


People also ask

Which method gets focus on new window?

Window.focus() Method The focus() method is used to focus on the new open window.


1 Answers

You cannot reliably force windows or tabs to grab focus. Some browsers are more amenable to the idea than others: IE will generally allow it, but Firefox has to be configured by the user to allow it, and Safari will basically never honor a focus request. (Well, almost never.)

like image 80
Pointy Avatar answered Oct 16 '22 03:10

Pointy