Gokhan Posted September 9, 2014 Share Posted September 9, 2014 (edited) Hello all, I try to add a favicon to an HTML page. It works when I use the code below: <!DOCTYPE html><html><head><title>Example</title><link rel="icon" type="image/gif" href="http://www.w3schools.com/tags/demo_icon.gif"></head><body><p>An example paragraph.</p></body></html> It uses the logo shown in the tutorial section. After that I downloaded that image and saved to the same folder as the HTML page I use. When I change the code to the below one it doesn't work: <!DOCTYPE html><html><head><title>Example</title><link rel="icon" type="image/gif" href="demo_icon.gif"></head><body><p>An example paragraph.</p></body></html> What is the problem here? When I refer to an adress on the web it works but when I refer a file in my hard drive it doesn't. I also try to use an .ico file generated online however it didn't work too. Could someone help me about my problem? Edited September 9, 2014 by Gokhan Link to comment Share on other sites More sharing options...
niche Posted September 9, 2014 Share Posted September 9, 2014 Does your code match the actual filename (upper and lower characters) including directory? Link to comment Share on other sites More sharing options...
Gokhan Posted September 10, 2014 Author Share Posted September 10, 2014 Does your code match the actual filename (upper and lower characters) including directory? Yes it matches. I searched about it a bit and it seems Chrome and IE doesn't allow local favicons. I will try it once with Firefox. Link to comment Share on other sites More sharing options...
Professor GIBS Posted September 19, 2014 Share Posted September 19, 2014 (edited) I just copy & pasted the code you provided, and it worked perfectly in Firefox, Opera, and Google Chrome. Just remember to add a shortcut link: <link rel="shortcut icon" href="PICTURE.png" type="image/png" sizes="16x16"/> Edited September 19, 2014 by Professor GIBS Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now