How do I add a favicon to a JSF project and reference it in <link> element?
I tried as below:
<h:head>
<link rel="icon" type="image/x-icon" href="images/favicon.ico"/>
...
</h:head>
However, it didn’t show any favicon.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A relative
hrefis relative to the current request URI. Likely it resolved to an invalid URL. You need to prepend with the context path so that it becomes relative to the domain root.Also, the
relhas better to beshortcut iconto get it to work in older browsers too.In case of using an
.icofile, you also need to ensure that it’s a real.icofile and not some.bmprenamed to.ico. You can generate one here based on several image formats. You can however also just use a.pngor.giffile.All in all, provided that the file is located in
then this should do it:
If you’ve however placed it as a JSF resource in the
/resourcesfolder as followswhich would make it accessible by
<h:graphicImage name="images/favicon.ico">, then this should do it:See also: