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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With