Giving a child window focus in IE8

Posted by Andrew K on Stack Overflow See other posts from Stack Overflow or by Andrew K
Published on 2009-11-17T21:26:06Z Indexed on 2010/04/10 18:03 UTC
Read the original article Hit count: 978

Filed under:
|
|

I'm trying to launch a popup window from a Javascript function and ensure it has focus using the following call:

window.open(popupUrl, popupName, "...").focus();

It works in every other browser, but IE8 leaves the new window in the background with the flashing orange taskbar notification. Apparently this is a feature of IE8:

http://msdn.microsoft.com/en-us/library/ms536425%28VS.85%29.aspx

It says that I should be able to focus the window by making a focus() call originating from the new page, but that doesn't seem to work either. I've tried inserting window.focus() in script tags in the page and the body's onload but it has no effect. Is there something I'm missing about making a focus() call as the page loads, or another way to launch a popup that IE8 won't hide?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ie8