A few things about favicon.ico (it’s best to put it in the root directory)

A few things about favicon.ico (it’s best to put it in the root directory)

Open any web page: for example, http://www.baidu.com/

image

You can see that there is an icon displayed on the browser tab header. This icon is: image , which is what we often call favicon.ico.

Since this article mainly discusses favicon.ico and the different ways in which each browser handles it, we will create a new web project as follows:

image

image

image

image

The code of home.html is as follows:
XML/HTML CodeCopy content to clipboard
  1. <!DOCTYPE html >   
  2. < html   xmlns = "http://www.w3.org/1999/xhtml" >   
  3. < head >   
  4.      < title > home page </ title >   
  5.      < link   rel = "icon"   href = "Images/wangyi.ico"   type = "image/x-icon"   />   
  6.      < link   rel = "shortcut icon"   href = "Images/wangyi.ico"   type = "image/x-icon"   />   
  7. </ head >   
  8. < body >   
  9. home page
  10. </ body >   
  11. </ html >   

firefox: image

ie9: image

Unfortunately, most ordinary users use 360 ​​browser, Sogou browser, QQ browser, etc.

Sogou Browser: image

It can be seen that the favicon.ico in the root directory of the website is effective, so the favicon.ico icon in the root directory of the website is displayed.

Open 360 Browser: image

Strange, where did the Google icon come from? . . . ? ? ?

Our faviconTestWeb has only 3 icons, one of which is wangyi.ico.baidu.ico.favicon.ico (the icon of cnblogs).

Why does 360 display the Google icon?

In fact, when 360 browser browses the web, it will ignore the port, that is, http://localhost:3529/home.html,

Firefox requests the icon corresponding to the href of the link.

Sogou Browser, etc.: The request is http://localhost:3529/favicon.ico.

360 browser, etc.: The request is http://localhost/favicon.ico,

That is, no matter whether you request http://host/home.html, http://host:333/home.html, or http://host/test/home.html.

It requests http://host/favicon.ico.

The evidence is to open the 360se installation directory:

image

So if your website's favicon.ico doesn't work, or if you want to make favicon.ico more compatible, use the following steps:

1: Check the favicon.ico in the root directory of the website, that is, http://host/favicon.ico., not http://host/some/favicon.ico.

2: Make sure <link rel="icon" href="http://host/favicon.ico" type="image/x-icon" />

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

Using http://host/favicon.ico

3: If your website has a port, or is a test version, then pay special attention to browsers such as 360, which will ignore the port number when requesting favicon.ico.

<<:  Detailed explanation of the process of installing MySQL on Ubuntu 18.04.4

>>:  MySQL database terminal - common operation command codes

Recommend

How to import js configuration file on Vue server

Table of contents background accomplish Supplemen...

Mysql some complex sql statements (query and delete duplicate rows)

1. Find duplicate rows SELECT * FROM blog_user_re...

Use Element+vue to implement start and end time limits

This article example shares the specific code for...

Detailed explanation of Nginx's rewrite module

The rewrite module is the ngx_http_rewrite_module...

How to install ZSH terminal in CentOS 7.x

1. Install basic components First, execute the yu...

Detailed example of clearing tablespace fragmentation in MySQL

Detailed example of clearing tablespace fragmenta...

How to install MySQL via SSH on a CentOS VPS

Type yum install mysql-server Press Y to continue...

Nginx forwarding based on URL parameters

Use scenarios: The jump path needs to be dynamica...

Detailed tutorial on installing MySQL database in Linux environment

1. Install the database 1) yum -y install mysql-s...

MySQL multi-instance installation boot auto-start service configuration process

1.MySQL multiple instances MySQL multi-instance m...

Reasons and solutions for failure to insert emoji expressions in MySQL

Failure Scenario When calling JDBC to insert emoj...

Vue custom component implements two-way binding

Scenario: The interaction methods between parent ...

Vue Basics Introduction: Vuex Installation and Use

Table of contents 1. What is vuex 2. Installation...

How to implement logic reuse with Vue3 composition API

Composition API implements logic reuse steps: Ext...