开发者

How to display a favicon for web app using Tomcat? [duplicate]

This question already has answers here: How to add a browser tab icon (favicon) for a website? (13 answers) Closed 开发者_开发问答6 years ago.

Does anyone know how to implement a favicon icon for a particular application using Tomcat? This icon file would not be for all webpapps, just this one on the server in question.


Just add the following code in the <head> to your index.html in you webapp/projectName/

<link rel="shortcut icon"
 href="http://example.com/myicon.ico" />


I like to add that the original tag type for the link was "shortcut icon", but that didn't conform to the standard so it was sort of switched to "icon".

So I recomend add both to your head block:

<link rel="icon" href="http://www.example.com/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="http://www.example.com/favicon.ico" type="image/x-icon"> 

Also some browsers don't support sizes other than 16px X 16px.


Delete or rename tomcat/webapps/ROOT/favicon.ico and Tomcat will look for a favicon.ico in the root of each web app that it serves. You don't need to put a into the head section of each page.


<link rel="shortcut icon" href="http://example.com/myicon.ico" />

add that within the <head> of your page - where the .ico file is an icon - there are several websites (use google) that generate .ico files from pictures (gif / jpeg etc)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜