0

I am trying to add a favicon.ico in my title but it is not working. The image and the HTML file are in the same folder but it still can't show me the favicon icon.

<title><link href="\Users\fjoni_000\Desktop\Stuff\Projects\Programming\favicon.ico" rel="shortcut icon">Best Of Internet | Front page</title>

This is the code that I am using. I tried with the Google logo and still it didn't show. This is the code from Google source code:

<link href="/images/branding/product/ico/googleg_lodp.ico" rel="shortcut icon">

If there is any question similar to mine and has the answer that I'm looking for then please comment it. Also the website is locally hosted NOT online

3 Answers3

2

The <link> should not be within the <title>... it should be outside of the <title> but still within the <head>...

<head>
  <title>Best Of Internet | Front page</title>
  <link href="\Users\fjoni_000\Desktop\Stuff\Projects\Programming\favicon.ico" rel="shortcut icon">
  ...

Although I think the main issue you have is it looks like a local system path, not a URL as understood by your browser. And you're also missing the type attribute

Without knowing the setup of your website server... I would take a complete guess that you want something like...

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

Just as an additional point, if you're able to... simply placing the favicon.ico file in the root of your domain is enough for the majority of browsers to pick up. Then you don't need the <link> at all

freefaller
  • 19,368
  • 7
  • 57
  • 87
  • that didn't work either. The website is not published it is on my computer only. –  Jun 16 '16 at 18:28
  • In that case you need to tell the browser the file is local... try (and I'm not promising anything) changing the `href` attribute to `href="file:///C:\Users\fjoni_000\Desktop\Stuff\Projects\Programming\favicon.ico"` – freefaller Jun 16 '16 at 18:30
  • You should also make it clear in your question that you're talking about a locally hosted site - 99% of readers will assume it's a site on the internet – freefaller Jun 16 '16 at 18:32
  • this is the code I'm using at the moment –  Jun 16 '16 at 18:32
  • I would recommend looking through [this question](http://stackoverflow.com/questions/11221292/local-file-website-favicon-works-in-firefox-not-in-chrome-or-safari-why)... it appears to be asking the same thing and has lots of answers to try – freefaller Jun 16 '16 at 18:34
  • the answer of that question worked I just have to change that path of image to mine. Thanks –  Jun 16 '16 at 18:38
0

You could try to clear your browser cache and try again. Do you have a live URL?

Joep vg
  • 17
  • 4
0

you adding Favicon inside the title tag which is wrong and make sure the icon exist in path. try this

<title>your title</title>
<link href="/images/branding/product/ico/googleg_lodp.ico" rel="shortcut icon">
Dahdoul
  • 125
  • 1
  • 3
  • 12