Facebook – How to Disable Flashing Title for Messages

facebookfacebook-notifications

If someone messages me on Facebook while I'm reading in another tab, the Facebook title will keep flashing back and forth. It is distracting for me. I don't object to changing the title, I just prefer to make it static. Does anybody know how to disable this feature?

I found a question in Stack Overflow asking how to make it dynamic: How to create flashing page title effect like facebook?

Best Answer

I know, this is extremely annoying.

You can try this on Chrome. This worked for me (with a pinned tab), in February 2017.

Create folder somewhere on your hard drive and create these two files in it:

manifest.json

{
  "manifest_version": 2,
  "name": "Pinned Tab Flashing",
  "version": "1.0",
  "description": "Disable pinned tabs flashing",
  "content_scripts": [{
    "matches": ["https://www.messenger.com/*"],
    "js": ["content.js"]
  }]
}

content.js

function titleModified() {
  var text = document.getElementsByTagName('title')[0].text;
  if (text != 'Messenger') {
    document.getElementsByTagName('title')[0].text = 'Messenger';
  }
}

window.onload = function() {
  var titleEl = document.getElementsByTagName("title")[0];
  var docEl = document.documentElement;

  if (docEl && docEl.addEventListener) {
    docEl.addEventListener("DOMSubtreeModified", function(evt) {
      var t = evt.target;
      if (t === titleEl || (t.parentNode && t.parentNode === titleEl)) {
        titleModified();
      }
    }, false);
  } else {
    document.onpropertychange = function() {
      if (window.event.propertyName == "title") {
        titleModified();
      }
    };
  }
};

Navigate to chrome://extensions/, click on Load unpacked extension and choose the folder you created. Then refresh your Messenger page.