Reputation: 63
I have this horrible problem with favicon.ico in my HTML page. Here's a look at my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<title>Games</title>
I have put the favicon in the same directory as my HTML file because putting it in my resources folder didn't seem to work either. What do I do? It will not show up ANYWHERE on ANY browser.
Upvotes: 1
Views: 110
Reputation: 1445
If you just want to test that the favicon works locally, change the path to wherever the favicon.ico
file is relative to the HTML document:
If it's in a sub-directory called foo
:
<link rel="icon" href="foo/favicon.ico" type="image/x-icon" />
If it's one directory level above:
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
etc.
Upvotes: 0
Reputation: 219894
You need to put it in the root web directory. Why? Because that's what you're linking to.
Upvotes: 1
Reputation: 15933
use the alternate syntax:
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
Upvotes: 1