7

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?

user338418
  • 105
  • 1
  • 7
  • Have you tried overriding the `window.alert` function? i.e. `window.alert = function(text) {....}` and see if this doesn't solve your problem? – Buhake Sindi Aug 06 '10 at 11:53
  • possible duplicate of [window.focus(), self.focus() not working in firefox](http://stackoverflow.com/questions/2533305/window-focus-self-focus-not-working-in-firefox) – Marcel Korpel Aug 06 '10 at 12:18
  • window.alert = function(text) {....} works but does not provide window focusing. – user338418 Aug 06 '10 at 13:07

1 Answers1

2

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.)

Pointy
  • 405,095
  • 59
  • 585
  • 614