java - 急求,favicon.ico的使用
天蓬老师
天蓬老师 2017-04-18 09:51:20
0
4
812

想在网站加一个图标,用的是

<link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
<link rel="bookmark" href="favicon.ico"/>

百度说是会先在页面文件同级目录下寻找favicon.ico,如果没有回到网站根目录寻找
在本地里我放在我页面的同级目录下,报的是

GET http://localhost:8080/favicon... 400 (Bad Request)

错误,本地好像用的是maven运行的,我对java不是很懂,可能描述有点出入,也不知道是不是这个原因。
项目文件和服务器上的一样,服务器上在ROOT的tomcat的文件夹里有favicon.ico文件,我把这个文件替成我的网站的icon,可是还是显示tomcat的icon,清了浏览器缓存还是不行。

对这个问题我有点懵逼,求知:
1.网站根目录具体指什么,在ftp上我应该怎么找网站根目录
2.favion.ico到底应该放在哪里,引用的时候目录应该怎么写
3.tomcat启动时的图标到底是怎么加进去的,为什么我把favicon.ico文件替换、删除都依然显示。

求大神帮忙!!!

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(4)
阿神

Thank you for the invitation.
1. The root directory is the directory entry for domain name access, that is, it depends on which file your server is configured in the project
2.favicon.ico can be placed in the root directory, and it can be quoted directly in the header <link rel="shortcut icon" type="image/ico" href="/favicon.ico">3. Delete /Replacement still exists, probably a cache issue. See how hard you brush it a few times

PHPzhong

The root directory is the folder that your domain name points to and is used to display web pages. Just put favicon.ico into the corresponding folder

洪涛

You just need to write the address of href="favicon.ico" as an absolute path

小葫芦

No need to write like this. Rename any picture to favicon.ico and put it in the root directory of the website
For example: http://www.baidu.com/favicon.ico

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!