user1548544
user1548544

Reputation: 2995

favicon not showing

I'm trying to add a favicon to my url-bar. But it's not showing up, I'm sure the path is correct because when I use it as a normal image it does show up. Here is the html code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title> title </title>
    <link href = "styles.css" rel="stylesheet" type="text/css" />

    <link rel="icon" type="image/png" href="../images/favicon.png">

Upvotes: 10

Views: 35007

Answers (3)

A_nto2
A_nto2

Reputation: 1096

First, try to give the full URL istead. For example "http://localhost/mysite/images/favicon.png" (adapt it to your configuration, actually)

Otherwise, on my site, this works:

<link rel="shortcut icon" href="images/favicon.ico" />

Try to:

  1. convert your png to ico. There are free online tools, for example http://www.convertico.com/
  2. be sure of your folder path. Won't be ./images instead of ../images? Try to give the full URL otherwise. For example "http://localhost/mysite/images/favicon.ico".
  3. after the above steps, try to clear the browser cache and reload the site.

Upvotes: 11

Vodun
Vodun

Reputation: 1385

use <link rel="icon" type="image/png" href="../images/favicon.png">

See W3C howto.

However, the format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors.

Upvotes: 2

Ayush
Ayush

Reputation: 42450

Your rel attribute needs to be icon and not shortcut icon.

There are several ways to set a Favicon, but this is what I use:

<link rel="icon" type="image/png" href="<?= base_url('assets/images/logos/favicon.png'); ?>" />     

Upvotes: -1

Related Questions