Bugs Development JavaScript Technical

Chrome problems with window focus (workaround)

Found a workaround for a window focus problem with Google’s Chrome browser.


var w =, ‘windowname’, ‘…’);

Problem is that the “focus” call doesn’t work … the 2nd time you call this function.

The workaround requires you to retain a pointer to the window as a global, and just close it before opening it again, like so:

if (navigator.userAgent.indexOf('Chrome/') > 0) {
    if (window.detwin) {
        window.detwin = null;
window.detwin =,  'windowname', '...');

Hard-coded it for Chrome as it works in all other browsers, except for Chrome.

The bug on the Google site references a potential issue with Webkit, but the latest version of Safari doesn’t have the issue at all.

Comment if this helped you!

11 replies on “Chrome problems with window focus (workaround)”

u can do some thing like this:

in parent:

var w =,’name’);

in child window:

if(window.parent && (navigator.userAgent.indexOf(‘Chrome/’) > 0)

This method faster, and u can open focus window many times without storing var w = …

sorry for my engliache ))))

Instead of closing the popup, then open a new one,
I’ve found out the following sequence was also fixing the Chrome (WebKit) bug.

if(typeof(win)!=’undefined’ && !win.closed) {
else {
win =, mypage_name, mypage_option);

In other words, if you use blur() on the window first then focus() function works.
Note: We’re currently using Chrome / working on XP.
I haven’t tested yet on Safari and/or other platforms, any feedbacks on other platforms will be well-appreciated.

var nextObject = document.getElementById(“select_combo_box”);
that example is not working in Chrome and safari.
Please give correct example for it that can run on every browser using Javascript or jQuery or MooTools

This method (to call blur() then focus() ) does not work for me on Chrome 5.0.375.126 on Mac OS X.
Any workarounds found for Chrome on Mac?

@Nick: The original method (closing, then opening) in the post above does work on Chrome 5.0.375.126 on Mac OS X. I haven’t tried the alternate methods proposed…

Comments are closed.