Mittwoch, 21 Januar 2026

Diese Woche am beliebtesten

Vertiefendes Material

Dynamic Favicon

Ein sich wechselndes Favicon für die eigene Hp

var DynFavIco = {

    // private properties. Browser detect. Do not touch! :)
    IE : ( document.all && document.getElementById && !window.opera ),
    FF : (!document.all && document.getElementById && !window.opera ),
    el : null,

    // private method.
    init : function () {

        if ( DynFavIco.FF ) {
            document.addEventListener("DOMContentLoaded", DynFavIco.domReady, false);
        } else {
            if ( DynFavIco.IE ) {

                document.write("<scr" + "ipt id=__ieinit_DynFavIco defer=true " +
                    "src=//:><\/script>");

                var script = document.getElementById("__ieinit_DynFavIco");
                script.onreadystatechange = function() {
                    if ( this.readyState != "complete" ) return;
                    this.parentNode.removeChild( this );
                    DynFavIco.domReady();
                };

                script = null;
            } else {
                window.onload = DynFavIco.domReady;
            }
        }

    },


    // private method.
    domReady : function () {

        DynFavIco.el = document.createElement('span');
        DynFavIco.el.style.display = 'none';
        document.body.appendChild(DynFavIco.el);

    },


    // public method.
    change : function (icon) {

        DynFavIco.el.innerHTML = '<link rel="shortcut icon" href="'+icon+'">';

    }

}

DynFavIco.init();
Dreamcodes Redaktion
Dreamcodes Redaktion
Qualität als Standard. Verantwortung als Prinzip. Jede Ressource auf Dreamcodes basiert auf geprüften Best Practices und fundierter Praxiserfahrung. Unser Anspruch ist ein belastbares Fundament statt experimenteller Lösungen. Die Integration und Absicherung der Inhalte liegt in Ihrem Ermessen. Wir liefern die fachliche Basis, die Verantwortung für den produktiven Einsatz verbleibt bei Ihnen.

Vielleicht einen Blick WERT?