通过http头添加图标 [英] Adding favicon through a http header
问题描述
所以我尝试在servlet头中添加一个http头。我希望我的标题与html head元素相同:
< link rel =快捷方式图标href =http: //foo.com/favicon.ico\">
我这样添加它:
httpResponse.addHeader(Link,< http://foo.com/favicon.ico> ;; rel = \快捷方式图标\);
在我的浏览器中,我看到了这个标题:
链接:< http://foo.com/favicon.ico> ;;不幸的是,这对IE或Chrome没有任何影响。但是,不幸的是,这对IE或Chrome没有任何影响。任何人都试图达到同样的目的?难道我做错了什么?这是否应该工作?解决方案答案是:这种方法依赖于提议的标准还未实现(感谢 Salman A 指出了这一点)。
如果它工作的话,它会很棒。
Let's assume that I want to add a favicon on a dynamically generated page (specifically an ADF Faces page, but this is irrelevant). I can't modify a tag of my resulted html.
So I try to add a http-header in servlet header. I want my header to be identical to html head element:
<link rel="shortcut icon" href="http://foo.com/favicon.ico">
I'm adding it this way:
httpResponse.addHeader("Link", "<http://foo.com/favicon.ico>; rel=\"shortcut icon\"");
And in my browser I see this header in response:
Link: <http://foo.com/favicon.ico>; rel="shortcut icon"
But, unfortunately, this does not have any effect in IE or Chrome. Anyone tried to achieve the same thing? Am I doing something wrong? Is that should work at all?
解决方案 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.
这篇关于通过http头添加图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!