Is there some directive I could use in my HTML to tell the browser not to ask for the favicon?
-
3See http://stackoverflow.com/questions/1321878/how-to-prevent-favicon-ico-requests – Benjamin Feb 01 '11 at 19:48
-
3How about redirect `/favicon.ico` to download a 1 gig file hosted on someone elses server? :) – meder omuraliev Feb 01 '11 at 19:48
-
2well, maybe if you point the browser to something silly (localhost, for example), it'd not request the favicon. But I've got to wonder, are requests for the favicon really that significant? Can't you just configure your server to 404 them quickly? – derobert Feb 01 '11 at 19:48
4 Answers
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.

- 329
- 3
- 8
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" />

- 18,429
- 11
- 54
- 75

- 442,112
- 142
- 972
- 1,088
You could try pointing the <link>
at a data URL. As commented below, IE will not like this, though.
Example (from 11011.net):
<link rel="icon" type="image/gif" href="data:image/gif;base64,R0lGODlhEAAQAIAAAAAAAAAAACH5BAkAAAEALAAAAAAQABAAAAIgjI+py+0PEQiT1lkNpppnz4HfdoEH2W1nCJRfBMfyfBQAOw==" />
Edited to reflect Pekka's concern regarding IE.

- 17,291
- 7
- 48
- 81

- 4,226
- 1
- 22
- 43
-
2Interesting idea, but won't work in IE. IIRC, the use of data URIs is limited to image sources there... It still is worth a try, maybe it blocks fetching it anyway – Pekka Feb 01 '11 at 19:49
-
Some suggest using "about:blank" in the href. https://webmasters.stackexchange.com/questions/34544/can-i-instruct-the-browser-not-to-look-for-a-favicon – ADJenks Mar 26 '18 at 18:28
If you are not using HTML and its auto generated by Flask or some frameworks you can always add a dummy route in the app to just return dummy text to fix this issue.
Eg for Python Flask Application.
@app.route('/favicon.ico')
def favicon():
return 'dummy', 200

- 906
- 11
- 22