How to add favicon to an ASP page - html

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.

Related

Favicons used in HTML

New to development and learning..
Do you have to download the favicon to your computer in order to reference in your HTML code OR can you reference image directly from web?
The image must be served from a Web Server. It could be from your own server or any other web page.
For example, assuming the image is in your main folder you can add it with:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
Note: Displaying an image on a website by linking to another website is called hotlinking and should only be done when the website explicitly allows it.

Not showing the favicon icon in chrome

I had inserted the tag:
<link rel="shortcut icon" href="Survey2016/favicon.ico"/>
This shows the icon in the Firefox browser, but it is not showing the in Chrome.
This is my tag:
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
Best practice is to just store the favicon in the root directory – or at least make it accessible there (through a URL rewrite f.e.).
You already did that, so you could remove the tag altogether. This is why you'd do that, you save a line of HTML.
With favorite icons, caching is a big problem. Sometimes opening the favicon directly (by typing /favicon.ico in the address bar) and then hard reloading (Shift+F5 or Shift+Click Reload) helps.
You might be having an old version of chrome which do not support favicon hosted on you local computer. Please host that image to an internet server and use it from that hosting website, that might help you.

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" />

Locating favicon location

The site uses a favicon stored in the root, but the https admin section is using the old favicon and I'm not sure where it's coming from.
Does anyone know of a way to find favicon site resources, i.e. where they're coming from? The unsecured pages all use the same head CSS with references to the same favicon, but the admin references no favicon, so I'm baffled as to why it's using the old one on those pages.
On your site using the selector document.querySelector("[rel='shortcut icon']") gets the element:
<link rel="shortcut icon" href="http://www.inside-guides.co.uk/favicon1.ico" type="image/x-icon">
You can reveal the element in the html panel with most javascript consoles if you want to see where its being declared in your html. In your case its declared:
If there is no favicon.ico in the root of the site, then view the source of the site and look for <link rel="shortcut icon"/>. It should have a href attribute. This would tell you the file location.
Most browsers will look for a favicon at /favicon.ico if they don't see a tag.
Source: https://stackoverflow.com/a/21359390/13683677

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.