Favicon not working - html

I can not get my browser icon to load.
<link rel="icon" href="pics/favicon.ico"/>
Also tried:
<link rel="shortcut icon" href="pics/favicon.ico"/>
When I open up Chrome developer tools and click the link to the ico file, I received a 404 error. The path is correct I have double and triple checked. Any help would be much appreciated.
EDIT I changed the file name to favicon and now the browser can find it but it does not render in the tab or address bar.
EDIT1 Icon size is 64x64. Thats not too big or is it?

Are you sure that the favicon.ico exists on the server. If you're getting a 404 when you go to view the file, the only answer is that either the path is wrong, or the file doesn't exist.
EDIT:
rel="shortcut icon" is correct. Try clearing your cache.

If you are using it's hard to refresh favicon from cache. But if you are using Google Chrome, just clean your cache end after that refresh your page.

I didn't have my icon on a server. It was on my local machine. Thanks everyone.

Related

Why am I seeing a 404 (Not Found) error failed to load favicon.ico when not using this?

Synopsis
After creating a simple HTML template for testing purpose, with no favicon.ico, I receive an error in the console "Failed to load resource: the server responded with a status of 404 (Not Found)" | "http://127.0.0.1:47021/favicon.ico".
I am trying to figure out where this error is coming from and wondered if someone had any ideas to point me in the right direction.
My HTML page looks like this:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Simple JavaScript Tester 01</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
When I run this page in Chrome browser and open the console, I see the error message "Failed to load resource: the server responded with a status of 404 (Not Found)" | "http://127.0.0.1:47021/favicon.ico". I am running this on a local IIS server. I see this same error message each time I create a new page.
Is it possible this error is coming from another page on my IIS server that I am unaware of?
By adding this to the header section, you will definitely remove the error in the console log:
<link rel="shortcut icon" href="">
From Chrome 2020 this is the solution :
<link rel="shortcut icon" href="#">
Because your browser always looks for the favicon.ico even if you don't specify it within your HTML.
So I'd suggest just creating one and placing it in the root of your website.
Google favicon generator and make an icon. Name it favicon.ico and drop it in your webroot.
See if this helps.
Also here is a tutorial on favicon: https://www.w3.org/2005/10/howto-favicon
You can add this to your <head> tag
<link rel="shortcut icon" href="#">
Works for me
<link rel="shortcut icon" href="~/favicon.ico">
You can't actually stop browsers requesting the image. However if you do have a favicon it can be cached by the browser which can reduce the number of requests coming in. so if you have the favicon in the root folder of the application the link above should work
It's nothing but an icon on your tab bar. This is the main point. You can also use any icon for your local file. However, the format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors. For more information please read this documentation: https://www.w3.org/2005/10/howto-favicon.
It is an old issue apparently, but since I'm just starting to learn coding...
I had the same favicon issue, both with FF and Chrome and unfortunately, none of the suggestions here helped.
Even when I have the "javascript.ico" file in my folder
<link rel="icon" href="javascript.ico" type="image/x-icon" />
this still wouldn't be able to find the icon, so the problem remained.
However, the following helped remove this error message:
just change the ".ico" extension of, both your file and in the HTML code into for example ".png"... problem solved, icon found.
<link rel="icon" href="javascript.png" type="image/x-icon" />
And after doing this, even if you change back the extension into ".ico", it'll still work and the error won't return.
I have faced the issue with using Angular. I have moved favicon.ico from src folder to assets/img and changed href in link tag in index.html:
<link rel="icon" type="image/x-icon" href="assets/img/favicon.ico">
Also I have removed src/favicon.ico from angular.json builder options.
It seems pretty lame, but the thing that works for me is that I just reload the page and the browser doesn't show any error.

Not showing the favicon icon in chrome

I had inserted the tag:
<link rel="shortcut icon" href="Survey2016/favicon.ico"/>
This shows the icon in the Firefox browser, but it is not showing the in Chrome.
This is my tag:
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
Best practice is to just store the favicon in the root directory – or at least make it accessible there (through a URL rewrite f.e.).
You already did that, so you could remove the tag altogether. This is why you'd do that, you save a line of HTML.
With favorite icons, caching is a big problem. Sometimes opening the favicon directly (by typing /favicon.ico in the address bar) and then hard reloading (Shift+F5 or Shift+Click Reload) helps.
You might be having an old version of chrome which do not support favicon hosted on you local computer. Please host that image to an internet server and use it from that hosting website, that might help you.

Adding a favicon - not working

I try to add favicon to my site.
I am upload the favicon to directory index and I add this line to my header site:
<link rel="icon" href="http://example.com/favicon.ico">
Maybe its chache?
help me please :)
edit:
I am dont see request to favicon :O
http://i.stack.imgur.com/1DET3.png
Any-asnwer not working..
Maybe I need clear chache?
EDIT: THIS IS WORKING NOW, THANKS FOR ALL!
Try this,
<link rel="shortcut icon" href="http://example.com/favicon.ico" />
Try this code
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
Put your favicon icon on root directory.
Also ensure that the favicon icon exists at the url("http://example.com/favicon.ico")
Your favicon may be the wrong bit depth and/or size. Save your favicon as an 8bit (jpg is 8-bit, but png is better and you can save for web as 8-bit, it doesn't need to be .ico) image and make sure to clear your cache. On upload, it should show in all browsers. Save it as ideally 16x16 pixels
Do you see your favicon when opening http://example.com/favicon.ico ?
If you do, try to reload the page http://example.com/ with CTRL + R
Try this Sure it will work
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<link rel="shortcut icon" type="image/png" href="http://eg.com/favicon.png"/>
There is another way you can do this
FoYou need to upload the favicon file “favicon.ico” to the server. To do so, point your browser address bar to your FTP server. Your URL might look similar to this:
“ftp: //username # websitedesign.com”
When you press enter, the browser will prompt you seeking an username and password. Once you get access to the root folder, upload your favicon file into it.
Now, you need to edit the HTML page of your website to help browsers fetch your favicon image while displaying your web page.
To do this, keep your FTP window open and download the “index.html” or “header.php” file from server and follow the steps below according to the file you get:
Now, insert the code below in the HEAD area of the “index.html” file, and change “yourwebsite.com” for your own website address.

Ico won't display on tabs

Using converticon.com, I converted my icon png file into an ico file. I placed the following code in my head tags:
<link rel="shortcut icon" href="icons/icon.ico">
I double checked and the file is in the appropriate location. The image has read and write capabilities. I then loaded the page on my browser but I all I get is an empty square box with a dotted border. I'm using XAMPP server. Why isn't the image displaying?
Did you try testing this on multiple browsers? Different browsers handle favicons differently.
Here are some things you could try.
Clear Your Cache
Delete all references of your link in your favorites.
Clear the file cache in your browser.
Shut down all instances of your target browser.
Reopen your browser and navigate to your website.
Force Refresh
If you are using Mozilla Firefox then you should:
Navigate to your website
Navigate to the exact location of your fav icon eg. www.site.com/favicon.ico.
Right click in browser window and select refresh.
When this is done Firefox is forced to reload the icon instead of the cached version.
Default behaviour of browsers
A second method for specifying a favicon relies on using a predefined URI to identify the image: "/favicon.ico", which is relative to the server root. This method works because some browsers have been programmed to look for favicons using that URI thus I would recommend placing the favicon in the root instead and see if that works. (rename the icon to favicon.ico also).
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
Image Format
At times there is an issue with the format of the favicon. If you are experiencing a problem across all web browser you could convert the favicon to gif or png and see if that solves the problem.
Force browser to update favicon
You can force your browser to update your favicon by passing a URL parameter. Using the ver parameter, you can increment the version number each time you want to force the downloading of new files.
add this to your markup.
<link rel="shortcut icon" href="/favicon.ico?ver=2.0" type="image/x-icon"/>
In MAMP (assume XAMP is same/similar) you would do the following:
- With MAMP running/open, hit the "Stop" button.
- Then go to: File > Edit Template > Apache httpd.conf
- Comment out lines:
#Alias /favicon.ico "/Applications/MAMP/bin/favicon.ico"
#Alias /icons/ "/Applications/MAMP/Library/icons/"
- Place your favicon.ico file in your site's root directory
- Start MAMP
You can probably do all sorts of crazy stuff here. Never worried about favicons during development, personally.
BTW - you don't have to clear your browser's cache, entirely. Just browse to the favicon and refresh it.... localhost:8888/favicon.ico
Just put the favicon at the root of your site, such as "example.com/favicon.ico" (make sure it is named favicon.ico though), and remove the above mentioned link element altogether. Browsers will check this location for a favicon by default if no is present, even IE.
After you do this, be sure to clear your cache when testing.
Try adding type attribute. Example:
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">

Favicon not showing up

I placed my favicon here:
http://www.vittoriosastarsnursery.com/favicon.ico
But for some reason it doesn't want to show in Firefox. It did work in IE, but I'm more concerned about getting it working in Firefox.
Suddenly I found answer here
You should add "?" to your favicon path and it works! Even with path such as images/favicon.ico. Just try:
<link rel="icon" href="/images/favicon.ico?" type="image/x-icon">
Other browsers works too.
Remember to restart mozilla, because of it's own cache, that is not connected with css and other caching.
updated:
Another way is set redirect from favicon.ico to /images/favicon.ico (301 works)
I can see it in Chrome, Firefox, and IE. My friend had a problem like this when we were testing back in college. It was just a weird caching thing that made her think it wasn't working right. I'm sure that everyone besides you will be able to see that it works fine.
Try opening the Dev Tools (CMD + Option + i on Mac) and hard refresh the page (hold the refresh button until options appear).
You could always try restarting your browser after clearing the cache and see if that helps.
<link rel="icon" href="http://khachmeruk.com/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="http://khachmeruk.com/favicon.ico" type="image/x-icon">
Two things to consider
If it's working in some browsers and not in others it's likely going to be a cache issue. Clear your cache and refresh, or for more in depth info: How do I force a favicon refresh
If favicon.ico is in the project's root folder but not being recognized by any browsers I would check out the .htaccess, or whatever equivalent of .htaccess depending on server type etc.
For those who suffer from this problem, try move your favicon file to home directory. It worked for me and solved my problem.
https://github.com/ritwickdey/vscode-live-server/issues/77
I was facing this problem with VS-Code live server, as discussed above it's browser cache issue, there is popular github thread on this.
just try the trick:
<link rel="icon" href="favicon.ico?v=2" type="image/x-icon"/>
Happy learning
If you don't want to spend hours. trying to figure out why your favicon is not showing up, make sure to always place it in the root of your project folder and add a link in the <head></head> section of your page like so:
<head>
//other code
<link rel="icon" href="favicon.ico" type="image/x-icon">
//other code
</head>
Folder Structure
--app
-----img
-----js
-----css
-----favicon.ico
It is just a caching issue. Just change the file name and it will show up immediately... otherwise do nothing and it will show up eventually. Browsers are just very persistent with the favicon caching.
It works for me in FireFox. When running identify (part of the ImageMagick package), it reports this problem:
identify: invalid colormap index 'favicon.ico' # error/image.c/SyncImage/3906
Perhaps opening the file in a graphics editor and re-saving it would clean up this error.
I had this problem too. it turns out (for me at least) that blocking users / agents with no referrer via .htaccess caused the problem.
Something that hasn't been mentioned that seems to have been the cause of my issue was the image file size. The image I was using was 4254px X 3850px at 1.3MB. It worked fine in Chrome desktop but not on Chrome mobile or Firefox. Changing the dimensions to 120px X 120px reduced the file size to 9.1KB and the favicon now works well.
P.s. This only works if your code has no issues.
For those who have tried everything and the favicon still does not show up:
Put it in your sites Root Directory
Rename it "favicon.ico"
Make sure your code is like such:
<link rel="icon" href="favicon.ico"/>
IF you still have the same problem, put the whole website in ANOTHER DIRECTORY, like a Memory Stick (that fixed it for me :) ).
REMEMBER: You HAVE to put the icon code in the of EVERY page. :)