Adding favicon through a http header

こ雲淡風輕ζ 提交于 2019-12-05 05:20:26
dragn

And the answer is: this method relies on proposed standard (a draft) that is not implemented yet (thanks to Salman A for pointing this out). Though it would be great if it worked.

nickl-

Yes Link headers have been a defined standard in RFC 5988 since October 2010 but the only link relation I've seen working are for stylesheet and only in some browsers at that.

Also see: HTTP Header Stylesheets

What @dragn is suggesting is perfectly viable, and in spec why the browsers aren't adopting is beyond me. There are some other useful relations like prefetch, bookmark and glossary to name a few. The least they could do is notify the user that links exist and provide it as a drop down or menu. Maybe a plugin is what is called for to show the browser vendors what we want it to do as it seems they are all confused. Any suggestions?

For now I guess we have to wait till 2020 for this feature to become available which seems to be the trent.

Yeah yeah "draft"..

anyway..

If you want to see how you can use it in-Practice, here is an example (taken from icompile.eladkarako.com)

<ifModule mod_headers.c>
  Header set Link <http://icompile.eladkarako.com/favicon.ico>; REL="shortcut icon"; TYPE="image/x-icon"
  Header set Link <http://icompile.eladkarako.com/favicon.ico>; REL="icon"; TYPE="image/x-icon"
  Header set Link <http://icompile.eladkarako.com/img/apple-touch-icon.png>; REL="apple-touch-icon"; TYPE="image/png"; sizes="316x316"
</ifModule>

It will work in current Chromium/Google Chrome/Google Canary,

(and for sure if you set the switch for advance web-features in chrome://flags)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!