Fulgut98
Fulgut98

Reputation: 323

Favicon isn't showing

I have a website, where I am trying to make a favicon. Only problem is, it isn't showing up. On my local host it just shows a cloud thing and on the page open using the html file it just shows the regular white page on all sites without a favicon.

This is how I am trying to implement it.

<link rel="icon" type="image/icon" href="http://www.mywebsite.com/myfavicon.ico"/>

<link rel="stylesheet" type="text/css" href="mainColorTest.css" />

Upvotes: 4

Views: 551

Answers (4)

Prime
Prime

Reputation: 3625

Keep some thing like this "favicon.ico" Browsers are smart and they will load your favicon without mentioning URL.

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

Remove cache or use CTRL+F5 to refresh page without cache.

Upvotes: 0

kamal
kamal

Reputation: 205

The first approach for specifying a favicon is to use the rel attribute value "icon" and to define what the value means via a profile; profiles are discussed in more detail below. In this HTML 4.01 example, the favicon identified via the URI http://example.com/myicon.png as being a favicon:

<!DOCTYPE html 
      PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head profile="http://www.w3.org/2005/10/profile">
<link rel="icon" 
      type="image/png" 
      href="http://example.com/myicon.png">
[…]
</head>
[…]
</html>

The XHTML 1.0 version looks very similar:

<!DOCTYPE html 
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
      xmlns="http://www.w3.org/1999/xhtml" 
      xml:lang="en-US"
      lang="en-US">
<head profile="http://www.w3.org/2005/10/profile">
<link rel="icon" 
      type="image/png" 
      href="/somewhere/myicon.png" />
[…]
</head>
[…]
</html>

If you are using HTML 5.... Then it would be like this:

Download favicon Put the favicon.ico file into your webserver directory If it's not in the root directory, add this HTML snippet between the ... tags of the page:

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

Replace YOUR_PATH with the correct paths - or -

Add this HTML snippet between the ... tags of the page. The whole image file is already included in the HTML. There is no need to upload the favicon.ico file. This works in all browsers except Internet Explorer.

<link href="data:image/x-icon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dUApKCBAGLz+wAfRFwAZfX4ABgLDQApVP8ARniKAMK1mwDv9/IAAAECAAMBAgC2oYQABwECAJqQfwDf6vAA5urnAP7+/gDg8vYA//7+AChU5QCdh24AwvX3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqDFyiQAqB3M+X06IJBlaqKg8XooAoaaNyrASXW2ST6gxAYpeAIM1Hpl5DH6rMFDOqM6zvQC+0lnDh8wYJ2XRZ6jOMaitxLi/YH27a4sipJOoqIZxrVgQf56sSs0ckA+Tzm6bdEI7OMu1pVaxP1MbkzeTfENkUZUoEy8WHWbPopMJp0jHtrkLgrIzqQ52d5cfVzaTugCdFWhNFy1jJWmBAMg9xiMAr4AhVZxBwFSfRs5bqJTCdbcDSQpLFBooeryo0ECgKxHBOqoyNClMLHAAqJFhb5p4j5YIhMlcewJHDa2t01IgtI7Fxa6uRAaFLoytqAWjYiZsbGpqmASoOUUAqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" rel="icon" type="image/x-icon" />

Upvotes: 0

Mehdi Sabouri
Mehdi Sabouri

Reputation: 122

I do this without writing a single line of code, and it always works.

just make sure the format of file is png, and it is exactly 16X16 pixels. then rename it exactly to 'favicon.ico' and put it on the root directory of your website.

your browser will automatically fetch the icon and use it wherever it needs. you may need to use ctrl+F5 on your browser to see the effect, (it makes a deeper refresh)

Upvotes: 1

Christian Fritz
Christian Fritz

Reputation: 21354

If it's an option, just rename your icon file to favicon.ico and put it in the root URL of your website, i.e., http://www.mywebsite.com/favicon.ico -- looks like you have access to that. After that, you don't need to put anything in your html, browsers will already find it.

Upvotes: 1

Related Questions