From 4b54e10d273d76b89770d567ae2c937731eda720 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 9 Jan 2014 10:26:53 +1100 Subject: [PATCH] only update title if it changes --- app/assets/javascripts/discourse.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 33e11803942..59abdb6336e 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -39,11 +39,14 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, { if (notifyCount > 0 && !Discourse.User.currentProp('dynamic_favicon')) { title = "(" + notifyCount + ") " + title; } - // chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome - window.setTimeout(function() { - document.title = "."; - document.title = title; - }, 200); + + if(title !== document.title) { + // chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome + window.setTimeout(function() { + document.title = "."; + document.title = title; + }, 200); + } }.observes('title', 'hasFocus', 'notifyCount'), faviconChanged: function() {