TransWikia.com

How can I make a favicon stay static?

Super User Asked on December 11, 2021

I’d like to prevent the favicon from changing on Firefox on my Mac.

I’m thinking that I might be able to do it with Grease Monkey.

My goal is to prevent things like Slack from changing the Favicon to indicate there’s a notification.

Can I tell websites that they must use the same favicon they loaded with without changing it?

2 Answers

You can write a Greasemonkey script that uses a Javascript mutation observer to observe when the favicon changes and then change it back immediately before you notice anything.

Here is how to do this:

  1. If you haven't done so already, install the Greasemonkey Firefox extension (this question is about Firefox, but you can also do this on Chrome and Edge by using the Tampermonkey extension: link for Chrome, link for Edge)

  2. Click on the Greasemonkey menu in the top bar, then select "New user script..." (if you're using Tampermonkey, the button is called "Create a new script...")

  3. When you've clicked on that button, it should open a new tab with a big text area where you can write Javascript code. The text area will probably already have some code in it. Simply delete that code and replace it with this:

    // ==UserScript==
    // @name         Do not change the favicon
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  Prevents sites from changing the favicon
    // @author       You
    // @match        http://*/*
    // @match        https://*/*
    // @grant        none
    // ==/UserScript==
    
    (function() {
        'use strict';
    
        //Initialize some variables
        var favicon = document.querySelector("link[rel='shortcut icon']");
        const initialIcon = favicon.href;
    
        //Define the function to run when the favicon changes
        var observer = new MutationObserver(function(){
            if(favicon.href != initialIcon){
                favicon.href = initialIcon;    //Change the favicon back directly when it changes before you notice anything
            }
        });
    
        //Run the function above whenever the favicon changes
        observer.observe(favicon, {attributes: true});
    })();
    

    The lines on the top that start with // define properties of the script. @name defines the name of the script, and @match defines on which sites the script should be run (http://*/* and https://*/* means all sites).

    The part on the bottom is the actual script with keeps the favicon from changing. As I explained in the beginning of my answer, what it does is it detects when the favicon changes and quickly changes it back before you notice anything.

  4. Press Ctrl+S to save the script, and then you should be done.

Answered by Donald Duck on December 11, 2021

You'd have to edit the cookie tied to the site/web app and change the value that allows notification. There are extensions like CookieCutter that allow you to edit cookies although that one is for Safari.

Answered by mxrclxst on December 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP