简体   繁体   English

快捷方式图标 - 它们隐藏在 html 代码中的什么位置?

[英]shortcut icon - where are they hidden in html code?

Most shortcut icon are presented in HTML like this:大多数快捷方式图标显示在 HTML 中,如下所示:

<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.但许多网站在其 html 代码中没有快捷方式图标,但 chrome 仍然在选项卡上显示图标。 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.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 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" . 属性规范rel="icon"实际上与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 , ie http://www.amazon.com/favicon.ico , and that's what browsers use, by convention. 在第一页上,没有影响favicon问题的标签,但是在服务器根目录下有一个名为favicon.ico的文件,即http://www.amazon.com/favicon.ico ,这就是浏览器使用的文件, 按照惯例。 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. 如果要在所有页面上使用相同的图标,则在服务器根目录下使用这样的名称放置图标将使link元素变得多余。 Of course, not everyone can put files at the server root. 当然,并非所有人都能将文件放在服务器根目录下。

you can also use.png file:你也可以使用 .png 文件:

<link rel="shortcut icon" type="x-icon" href=".directory/image.png" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM