locked
Set ICON for Browser Tab RRS feed

  • Question

  • User1416480938 posted

    Have an application that I am trying to add custom icon to display in browser tab. Have the basic MVC ASP.NET template set up. Where do I set my custom ICON???? I have added it to favicon.ico in the root of directory and also added it in the properties of the solution. When I run the app I continue to see just the default square box. What am I missing? 

    Wednesday, May 9, 2018 5:38 PM

Answers

  • User1724605321 posted

    Hi 1StormChaser43,

    Please confirm you have put the picture in Images folder under root of directory . In addition , what is your browser for testing ? It won't work on localhost it using Edge :

    https://stackoverflow.com/a/34047098/5751404 

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 10, 2018 6:50 AM

All replies

  • User-369506445 posted

    hi

    you can use below code :

        <link rel="shortcut icon" type="image/ico" href="~/Images/Arrow.png">
    

    put the above code in your header

    <html>
    <head>
      <link rel="shortcut icon" type="image/ico" href="~/Images/Arrow.png">
    
        <title>@ViewBag.Title - My ASP.NET Application</title>
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
    
    </head>
    @RenderBody()
    
    @RenderSection("scripts", required: false)
    </html>

    Wednesday, May 9, 2018 5:48 PM
  • User1416480938 posted

    I have added that and it still doesn't work... 

     

    Wednesday, May 9, 2018 7:13 PM
  • User1416480938 posted

    @{
    ViewBag.Title = "* Live *";
    }

    <html>


    <head>
    <link rel="shortcut icon" type="image/ico" href="/Images/storm-gps4.png">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="refresh" content="60">
    <title>@ViewBag.Title - Storm Command Center</title>


    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    //
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
    //
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

    <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?key=&callback=loadMapScenario' async defer></script>


    <script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://www.bing.com/api/maps/mapcontrol?key=&callback=loadMapScenario" defer="defer" type="text/javascript" async=""></script> <script></script>

    Wednesday, May 9, 2018 7:15 PM
  • User1724605321 posted

    Hi 1StormChaser43,

    Please confirm you have put the picture in Images folder under root of directory . In addition , what is your browser for testing ? It won't work on localhost it using Edge :

    https://stackoverflow.com/a/34047098/5751404 

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 10, 2018 6:50 AM
  • User409696431 posted

    Not all browsers pick up the icon right away if they've already visited the site before you added it.  What browser are you testing it with?

    Thursday, May 10, 2018 6:58 AM
  • User-369506445 posted

    I thing your problem is here

    href="/Images/storm-gps4.png">

    First you must sure about your path.

    If your image folder is in your root,try below

    href="~/Images/storm-gps4.png">

    Thursday, May 10, 2018 7:38 AM
  • User1416480938 posted

    Images where in right directory. I was running Edge on Local Host. That was the problem. Thank YOU and have a nice day.

    Thursday, May 10, 2018 1:24 PM