简体   繁体   中英

In IE 11 the favicon disappears on navigating to another page in Angular application

The issue is specific to Internet Explorer. The favicon works fine in chrome. I have an angular application which is running alongside the legacy application. When I navigate to the angular application from legacy application the favicon appears as expected in the internet explorer, but when I navigate within the angular application the favicon disappears.

  <link rel="icon" type="image/x-icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a" />

  <link rel="shortcut icon" type="image/x-icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a" />

I have tried full path, relative path, as well as CDN but nothing seems to be working.

I had this exact issue and this seemed to resolve it for me:

In your index.html file:

<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

Then you have to make sure you include the favicon in the assets of your angular.json file:

"apps": [
    {
        "root": "src",
        "outDir": "dist",
        "assets": [
            "assets",
            "favicon.ico", //Right here
            "web.config",
            "environments"
        ],

And finally, make sure that your icon is named favicon.ico, and that it is located in the src folder of your project. There are tools online to convert images into .ico files in case you have a different format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM