Changing the window title when focussing the window doesn't work in Chrome Changing the window title when focussing the window doesn't work in Chrome google-chrome google-chrome

Changing the window title when focussing the window doesn't work in Chrome


This appears to be a bug in Chrome regarding the actual redrawing of the tab title, since the document title itself (i.e. within the DOM) is in fact updated correctly.

I suppose that changing the tab (which causes the tab to move to the foreground, hence to be redrawn) and changing the title within the resulting focus event (which also requires a redraw) cause some kind of race condition.

That's why I tried this workaround, which does in fact work:

window.setTimeout(function () { $(document).attr("title", newtitle); }, 200);

– just wait for a short time before updating the title, so the two redraw events don't conflict with each other. That's not pretty, obviously, but a 0.2 second delay shouldn't usually be a problem.


although tiftik said this bug is fixed, it still happend at my Chrome (Version 21).

The solution balpha offered works for me too - but be aware not to set the document title to the new title on Focus and than wait 200ms to set it again - This won't work! (probably because Chrome thinks it is the same title, so it won't update)

Just wait 200ms and set it - works fine!


For future reference: this bug is currently fixed.