var iCab_FavIconHREF = "";

function iCab_GetFavIconLink() {
    var maxSize = 0;
    var linkElements = document.getElementsByTagName('link');
    if (linkElements && linkElements.length) {
        for (var i=0; i<linkElements.length; i++) {
            var element = linkElements[i];
            var value = element.getAttribute('rel');
            if (value == 'icon' || value == 'shortcut icon' || value == 'icon shortcut') {
                var href = element.getAttribute('href');
                var a = document.createElement('a');
                a.href = href;
                href = a.href;
                if (href && href.length && href.indexOf("svg", href.length - 3) < 0) {
                    iCab_FavIconHREF = href;
                    break;
                }
            }
        }
    }
    if (iCab_FavIconHREF == "") {
        var a = document.createElement('a');
        a.href = "/favicon.ico";
        iCab_FavIconHREF = a.href;
    }
}

iCab_GetFavIconLink(); iCab_FavIconHREF;
