如果favicon未命名为favicon.ico,该怎么办? [英] What if the favicon is not named favicon.ico?

查看:140
本文介绍了如果favicon未命名为favicon.ico,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何限制将收藏图标(favicon)文件命名为 favicon.ico



它可以被命名为任何东西,只要favicon标签引用正确的文件名即可。



例如:

 < link href =/ somefile .icotype =image / x-iconrel =icon/> 
< link href =/ somefile.icotype =image / x-icon =shortcut icon/>

上面的代码在显示图标时工作得很好。



我想知道的是,这违反了W3C / HTML规范,或者这是允许的用法吗?

解决方案

根据 W3C ,首选方法实际上是在html文档中指定了favicon,而不是依赖服务器根目录中的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未命名为favicon.ico,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆