4

I am making a HTML page that is unpublished and that I just started. The first thing I wanted to do was add a favicon to appear next to the title. I'm using Google chrome and I noticed that other websites have favicons that appear next to the title in the browser, but mine won't show up. I'm new to favicons. The site is in a folder on my desktop named site. This is the code:

<!DOCTYPE html>
<html> 
    <head>
        <title></title>
        <link rel="shortcut icon" href="favicon.ico" />
    </head>
    <body>
    </body>
</html>

2 Answers 2

6

If I understood you well, your website isn't in a webserver in your computer? If you are accessing your site with something like this file:///C:/Users/Me/Desktop/mysite.html, you are not in a webserver and gonna need one to access your site with something like this http://localhost/mysite.html.

The reason why is because Chrome seems to have problems with loading favicon files when your site isn't in a webserver environment. (Don't ask me why, I really don't know.) I've just tested your page on my desktop on Chrome and it dosen't work, after that I've tested on my localhost webserver and it works.

If you are not familiar with webservers, I would suggest WAMP server if you are on Windows. There should be information there about how to install it (it's actually pretty easy). After that you can put your website's files in the webserver's "public html folder" (C:/wamp/www/ in this case) and access your website with http://localhost/

Good luck :)

1
  • As an alternative to WAMP, you can simply install Python and run python -m http.server (for Python3) or python -m SimpleHTTPServer (for Python2) from the folder you want to locally host. Commented Sep 14, 2016 at 6:12
-1
<link href="favicon.ico" rel="shortcut icon" />

Try this.

Also make sure it is pointing to the right location, and that the icon file can also be displayed in other browsers.

If it also does not display in other browser, you probably don't have a valid .ico file or your pointing to the wrong location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.