Monday, April 5, 2010

Favicons

Here is a simple way to add favicon to you webpage. It is done using JSP and javascript:

<script language="javascript">

var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = '<%=request.getContextPath()%>/images/logos/favicon.ico';
document.getElementsByTagName('head')[0].appendChild(link);

</script>

Make sure to add your icon into the specified location relative to the context root.

0 comments:

Post a Comment