'Where is my angular project picking up the A favicon.ico from? It's not in my project
Just recently, code that has worked correctly since 2018 has started falsely showing the old default "A" favicon.ico from Angular. I have combed my code and can't find it anywhere. All of my entries point to the correct favicon.ico, which is a brand. This happened last week and I closed my browser and reloaded everything and it went away. Today, I moved from one building to another, switching wi-fi. I changed my start command from a specific IP address, ng serve --host 192.168.40.170, to a more generic ng serve, which is localhost, and it popped back up again!
I tried rebooting the browser, but this time it didn't go away. Am I the only one seeing this new irritation?
Solution 1:[1]
You have different solutions to solve this problem:
1. Replace the default flavicon.ico by your icon:
- Remove the default
src\flavicon.icofrom angular - Replace the
flavicon.icowith your icon in thesrcfolder
2. Use PNG as default icon (before Angular 9):
- Remove the default
src\flavicon.icofrom angular - Add your icon
flavicon.pngin thesrcfolder - Add it in the
index.html
<link rel="icon" type="image/x-icon" href="flavicon.png">
- Add your
assetsin your angular config file (angular-cli.jsonorangular.json)
angular-cli.json:
"assets": [
"assets",
"flavicon.png"
],
3. Use PNG\ICO as default icon (after Angular 9):
- Remove the default
src\flavicon.icomade by angular - Add your icon (
flavicon.pngorflavicon.ico) in theassetsfolder to make it visible to the browser - Change file in the
index.html(flavicon.pngorflavicon.ico)
<link rel="icon" type="image/x-icon" href=".assets/flavicon.png">
- Add your assets and you file (
flavicon.pngorflavicon.ico) in your angular config file (angular-cli.jsonorangular.json)
angular.json:
"assets": [
"assets",
"flavicon.png"
],
5. Completely remove default flavicon.ico from angular:
- Remove from index.html
<link rel="icon" type="image/x-icon" href="favicon.ico">
- Remove "favicon.ico" from assets in the config file (
angular-cli.jsonorangular.json) - Delete src/favicon.ico
6. Clear your browser (cache, cookies...) :
Windows:
- IE:
Ctrl+R - Firefox:
Ctrl+Shift+R - Chrome:
Ctrl+RorCtrl+F5orShift+F5
Linux:
- Firefox:
Ctrl+Shift+R - Chrome:
Ctrl+RorCtrl+F5orShift+F5
macOS:
- Safari:
?+R - Firefox/Chrome:
?+Shift+R
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

