Re: focus on the new window.open window
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: focus on the new window.open window

From: Thomas 'PointedEars' Lahn <PointedEars@web.de>
Date: Wed Nov 30 2005 - 16:40:15 CET

Csaba Gabor wrote:

> Up until a few weeks ago, javascript code like
>
> window.open("http://mydomain.com", "windowName");
>
> would always bring my new or reused window to the top, with focus.
> Lately, Firefox (Deer park alpha 2) only brings it to the top if the
> window is new. If it's being reused, the window does not come to
> the foreground (with IE 6 it does).

I do not think there is a significant change here. It is well-known
that reused windows are not always and everywhere focused.
 
However, Firefox 1.5 is out now, so I do not think Deer Park _alphas_
do really matter anymore. (I have not installed Firefox 1.5 yet.)

> Is there a new way in Mozilla/Firefox that I can ensure that this
> window comes to the top?

You could call the focus() method of the respective Window object
after it has been established on runtime that there are both:

  function isMethodType(s)
  {
    return (s == "function" || s == "object");
  }

  var w = window.open(...);
  if (w && !w.closed && isMethodType(typeof w.focus))
  {
    w.focus();
  }

PointedEars
Received on Sat Dec 3 04:33:36 2005