Question

Following code is for displaying favicon:

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

Path for my image is: wamp/www/widget_corp/favicon.ico.

The URL for page was: localhost/widget_corp/pat_apt.php.

Problem is: I cannot display favicon. Can anyone tell me why? Also, suggest me the way to display favicon for all pages. I went through some forums they suggested to edit the config file. Is that true? I am using WAMP Server 2.4.

Was it helpful?

Solution

Don't embed your favicon code in title tags. That's why you can't see it.

To include same code in various pages, create a php file to contain your head information:

header.php

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

Then call it between head tags of all of your pages:

<head>
  <title>My Title</title>
  <? require_once 'header.php'; ?>
</head>

OTHER TIPS

Use this:

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

you should put only your page's title text in <title>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top