How can you remove the favicon using Javascript in google chrome? The goal is to return it to the browser default, which is in this case a blank image.
I found this question, but it doesn't work if you leave the link.href
attribute as empty.
Even if the favicon is set because there is a favicon.ico file on the server, I'd like to remove it and set it back to the default.
This only needs to work in chrome.
Thanks!
From the context menu, select 'Options'. This will open a new tab listing all your bookmarks. Expand a folder of bookmarks, and select the bookmark you want to change the favicon for. Right-click the bookmark you want to change the favicon for, and from the context menu, select 'Change Favicon'.
By default, your browser will use the favicon in the same folder with your html file, so removing your link tag will do nothing. You need to move the favicon elsewhere or delete it. Then, if it stills shows up, clear your cache and go to the icon to see the new one.
$('head'). append('<link id="dynamic-favicon" rel="shortcut icon" href="https://www.XYZ.com/favicon.ico" />'); This works by adding a link to the head of the page, which changes the shortcut icon of the page to the specified image. Causing the image on the tab in the browser to change.
Favicon Changer. Lets you change favicons for your bookmarks, single webpages and entire websites.
Have you tried using an empty transparent image?
Try:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oFFAADATTAuQQAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAEklEQVQ4y2NgGAWjYBSMAggAAAQQAAGFP6pyAAAAAElFTkSuQmCC
Putting those comments into answer form:
Suggestions:
chrome-resource://favicon/
or chrome://favicon/
I'm a bit surprised the AJAX solution worked for you because, I'm on Chrome 4.1.249.1064 (45376) and it doesn't work for me.
EDIT: It doesn't seem like you'll need much from the AJAX solution. It seems that favicon.js
is all you really need. All it seems to do is what the JavaScript solution you mentioned plus a little more handling (ie remove existing favicon). Their "dynamic" part is just a document.onkeypress
.
EDIT: Additional reference:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With