Can I have more than one favicon.ico on my site? - html

I have a favicon.ico in my root directory. This now shows up when people browse to my site. I notice that I can also use the following:
<link
rel="icon"
href="[URL]
type="image/x-icon"
/>
<link
rel="shortcut
icon" href="[URL]
type="image/x-icon"
/>
Is there any advantage in adding this to my master page?
Can I use this syntax to specify different favico's for different pages on my site?
Thanks,

You can do it. (One different per page). But IMHO is better to provide consistency.
If you do that on your Master Page all the pages will share the same one (recommended).
Yes, you can specify as many as you want BUT need to provides the respective header declaration on each page.

Related

shortcut icon - where are they hidden in html code?

Most shortcut icon are presented in HTML like this:
<link rel="Shortcut icon" href="url" />
but many sites don't have shortcut icon in their html code but still chrome is showing me icons on tabs. How they made it? I want to download icons from different websites but I don't know where my crawler should look for them. Examples of websites where I can find it:
http://www.amazon.com/dp/0976470705?tag=lessolearn01-20&camp=0&creative=0&linkCode=as4&creativeASIN=0976470705&adid=0E34NG800FT9HMWYP4D6
http://www.startuplessonslearned.com/2008/10/lean-startups-vs-lean-companies.html
It is known as favicon (most of times!).
For the second link you pointed to, it is :
<link href='http://www.startuplessonslearned.com/favicon.ico' rel='icon' type='image/x-icon'/>
Also, it could be added in several ways. For more info read this article.
On the second page give as example, the tag is
<link href='http://www.startuplessonslearned.com/favicon.ico' rel='icon'
type='image/x-icon'/>
The attribute specification rel="icon" is practically synonymous with rel="shortcut icon".
On the first page, there is no tag that affects favicon issue, but at the server root there is a file with the name favicon.ico, i.e. http://www.amazon.com/favicon.ico, and that’s what browsers use, by convention. Putting an icon under such a name at the server root thus makes the link elements redundant, provided that you want to use the same icon for all pages. Of course, not everyone can put files at the server root.
you can also use .png file:
<link rel="shortcut icon" type="x-icon" href=".directory/image.png" />

How to add favicon to an ASP page

I want to add an favicon to my web application.
I've added this in the site.master page:
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
It is only working, when I run the application via Visual Studio.
If i start the app from IIS (for example) the favicon is not displayed.
Any thoughts on this?
If you want to add the same favicon to the whole site, there's no need to add any markup to the site - just ensure the file exists at http://yoursite/favicon.ico
If you need to have different favicons for different parts of the same site, then you will need to use the markup.

How to put a bookmark icon (favicon) in website

See the small logo/icon in the tab when you open any website in any browser?:
How can I put such logo/icon on my wordpress blog?
This is called a favicon. You link to it in the head section of your HTML.
You can read more about it here: http://www.w3.org/2005/10/howto-favicon
And view a list of Wordpress plugins that do the work for you here: http://wordpress.org/extend/plugins/tags/favicon
Two ways,
the first is use this plugin
http://wordpress.org/extend/plugins/shockingly-simple-favicon/
Or, if you really want to learn how it works. Open your theme folder (normally under wp-content -> themes -> your theme name) and then normally in the header.php file there is everythign that happens in the head of your pages.
Any where in the <head></head> place the following code...
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
Where /favicon, is the link to your favicon.ico.
To easily make a favicon, use the following link.
http://www.favicon.co.uk/
Hope this helps you learn how to do it and what the actual plugin does for you :)
Use plungin: http://wordpress.org/extend/plugins/shockingly-simple-favicon/
You just need to put the image into a file named favicon.ico in your website's root directory (like www.stackoverflow.com/favicon.ico). Browsers request this file when a user visits your site and will show it in the tab or bookmarks. You can find more info on wikipedia or even use http://www.favicon.cc/ to help you design the icon.
There are two ways.
In your template header.php file, you have to add the favicon code: <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
or, you just put the favicon.ico into your www root. Apache has a configuration setting which will load this as default.

What if the favicon is not named favicon.ico?

Are there any restrictions on naming the favorites icon (favicon) file as anything other than favicon.ico?
I know for sure that it can be named anything, as long as the favicon tag refers to the correct file name.
For example:
<link href="/somefile.ico" type="image/x-icon" rel="icon" />
<link href="/somefile.ico" type="image/x-icon" rel="shortcut icon" />
The code above works just fine in displaying the icon.
What I want to know is does this violate any W3C/HTML specifications or this is permitted usage?
According to W3C, the preferred method is to actually specify the favicon in the html document rather than relying on favicon.ico in the server root.

Favicon in subdirectory all subdomain

I am used to just save the favicon.ico in the public_html folder for adding the favicon.
The problema I have now is that I want to display the in all the files of a certain subdirectory, ( example.com/example "onwards" ) just putting it there, doesnt seem to do the job.
I know I could go document by document and add:
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
But I hope there is a more practical way, first I thought there might be a way trough CSS but that doesnt seem to be the case.
This would have come in handy because every document already includes:
<link rel="stylesheet" type="text/css" href="test.css" />
So any ideas or workarounds to how to solve this?
You will have to specify the favicon using the link rel=... notation.
Browsers will search only in the root directory of the domain for a default /favicon.ico. Any variations from that you have to specify explicitly.
Adding the <link> element is the right way to go. Use a template engine (e.g. Template-Toolkit) to avoid duplicating common content manually.
It might not be the most elegant way, and i came here to find a solution.
Unfortunaly the given answers did not suited for me.
In my case i working on a localhost (via private ip)
this is what i did :
<link rel="icon" href="<?php echo rtrim($_SERVER['PHP_SELF'], basename($_SERVER['PHP_SELF'])); ?>favicon.ico" type="image/x-icon">
As mentioned above don't waste time on searching. is the only way in that case. When you will be checking out results of your markup changes, remember that browser cache can be tricky.
redirect favicon.ico url for all subdomains to public_html's favicon.ico
ie. subdomain.website.com/favicon.ico should go to www.website.com/favicon.ico