Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent the browser from asking for the favicon?

Tags:

Is there some directive I could use in my HTML to tell the browser not to ask for the favicon?

like image 628
AngryHacker Avatar asked Feb 01 '11 19:02

AngryHacker


People also ask

How do I remove favicon from website?

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.

Can you have no favicon?

You don't need to, no, but some browsers will request /favicon. ico automatically, so the errors are pretty much unavoidable.

Do I need a favicon for my website?

Conclusion. As you can see, having a favicon on your website is crucial. Not only does it make your site distinguishable on browser tabs, but it also gives a professional look to your website. You can add it automatically by uploading a .


2 Answers

No, I don't think there is. From Wikipedia:

Most web browsers do not require any HTML to retrieve a favicon that conforms to the de facto file name and type (favicon.ico) located in the web site's root. If no favicon link is detected upon HTML page load completion and no previous site visits are recorded in the browser's history, a favicon.ico is requested automatically.[8]

The only thing you could do is explicitly point the browser to a different location (that for example could return a 204 no content)

<link rel="shortcut icon" href="http://www.example.com/my_empty_resource" /> 
like image 125
Pekka Avatar answered Oct 06 '22 02:10

Pekka


Add this line.

<link rel="icon" href="data:,"> 

This assigns an empty data URL to the favicon’s element which specifies the location of the external resource. This trick stops the user’s browser from sending an automatic HTTP request for the favicon.

This has some more details

like image 39
Manudeep Avatar answered Oct 06 '22 00:10

Manudeep