Html 我收到 favicon.ico 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31075893/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I'm getting favicon.ico error
提问by Rockstar5645
I downloaded the Netbeans IDE to code in HTML. I'm new to it. When I run my code, chrome is opening and everything is working just fine. I'm getting some sort of error in the Output - Browser Log.
我下载了 Netbeans IDE 来编写 HTML 代码。我是新手。当我运行我的代码时,chrome 正在打开并且一切正常。我在输出 - 浏览器日志中遇到某种错误。
Failed to load resource: net::ERR_EMPTY_RESPONSE (20:00:55:963 | error, network)
at http://localhost:8383/favicon.ico
How do I fix it?
我如何解决它?
回答by element11
I have had this error for some time as well. It might be some kind of netbeans bug that has to do with netbeans connector. I can't find any mention of favicon.ico
in my code or in the project settings.
我也有一段时间出现这个错误。这可能是某种与 netbeans 连接器有关的 netbeans 错误。我favicon.ico
在我的代码或项目设置中找不到任何提及。
I was able to fix it by putting the following line in the head
section of my html file
我能够通过将以下行放在head
我的 html 文件部分来修复它
<link rel="shortcut icon" href="">
I am currently using this in my testing environment, but I would remove it for any production environment.
我目前在我的测试环境中使用它,但我会在任何生产环境中删除它。
回答by Agu Dondo
The accepted answer didn't work for me, I had to add a value to the href attribute:
接受的答案对我不起作用,我不得不为 href 属性添加一个值:
<link rel="shortcut icon" href="#" />
回答by Trinadh venna
favicon.ico is the icon of a website on the title bar of your website. Netbeans couldnt find the favicon.ico file in your website folder
favicon.ico 是网站标题栏上的网站图标。Netbeans 在您的网站文件夹中找不到 favicon.ico 文件
if you dont want it, you can remove the line that is similar to this in your head section
如果你不想要它,你可以在你的头部部分删除与此类似的行
<link rel="shortcut icon" href="favicon.ico">
or if you want to use an icon for the title bar, you can use icon convertorto generate a .ico image and keep it in your website folder and use the above line in the head section
或者,如果您想为标题栏使用图标,您可以使用图标转换器生成一个 .ico 图像并将其保存在您的网站文件夹中,并在头部部分使用上述行
回答by Arnon Erez
The accepted answer didn't work for me so I've found this solution.
接受的答案对我不起作用,所以我找到了这个解决方案。
It may be related to the HTML version as the most voted solution there states:
它可能与 HTML 版本有关,因为那里投票最多的解决方案指出:
If you need your document to validate against HTML5 use this instead:
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
如果您需要您的文档针对 HTML5 进行验证,请改用以下代码:
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
See the link for more info.
查看链接了解更多信息。
回答by Petya Kostova
The answers above didn't work for me. I found a very good article for Favicon, explaining:
上面的答案对我不起作用。我为 Favicon找到了一篇很好的文章,解释说:
- what is a Favicon;
- why does Favicon.ico show up as a 404 in the log files;
- why should You use a Favicon;
- how to make a Favicon using FavIcon from Picsor other Favicon creator;
- how to get Your Favicon to show.
- 什么是网站图标;
- 为什么 Favicon.ico 在日志文件中显示为 404;
- 为什么要使用 Favicon;
- 如何使用来自 Pics或其他 Favicon 创建者的FavIcon制作 Favicon;
- 如何让您的 Favicon 显示。
So I created Favicon using FavIcon from Pics
. Put it in folder (named favicon) and add this code in <head>
tag:
所以我使用FavIcon from Pics
. 将其放入文件夹(名为 favicon)并将此代码添加到<head>
标签中:
<link rel="shortcut icon" href="favicon/favicon.ico">
<link rel="icon" type="image/gif" href="favicon/animated_favicon1.gif">
Now there is no error and I see my Favicon:
现在没有错误,我看到了我的 Favicon:
回答by Sr Julien
For me the answer didn't work too, but this work fine:
对我来说,答案也不起作用,但这工作正常:
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
回答by Larry
You can provide your own image and reference it in the head, for example:
您可以提供自己的图像并在头部引用它,例如:
<link rel="shortcut icon" href="images/favicon.ico">
回答by Johnny
Also, be careful so your href location isn't faulty. Study case:
另外,请注意确保您的 href 位置没有错误。研究案例:
My index page was in a temporary sub-folder named LAYOUTS. To reach the favicon.png from inside the IMAGES folder, which was a sibling of the LAYOUTS folder, I had to put a path in my href like this
我的索引页位于名为 LAYOUTS 的临时子文件夹中。要从 IMAGES 文件夹(LAYOUTS 文件夹的同级文件夹)内部访问 favicon.png,我必须像这样在我的 href 中放置一个路径
href="../images/favicon-32x32.png"
Double periods are necessary for folder navigation "upwards", then the forward slash + images
string gets you into the images folder (performing a tree branch "jump") and finally you get to reference your file by writing favicon-32x32.png
.
文件夹导航“向上”需要双句点,然后正斜杠+images
字符串将您带入图像文件夹(执行树枝“跳转”),最后您可以通过编写favicon-32x32.png
.
This explanation is useful for those that start out from scratch and it would have been useful to have seen it a couple of times since I would forget that I had certain *.php files outside the LAYOUTS folder which needed different tree hrefs on my links, from the HEAD section of each page.
这个解释对那些从头开始的人很有用,如果我看过几次会很有用,因为我会忘记我在 LAYOUTS 文件夹外有某些 *.php 文件,这些文件需要在我的链接上使用不同的树 hrefs,从每页的 HEAD 部分。
Reference the path to your favicon image accordingly.
相应地引用您的网站图标图像的路径。
回答by abdesselam
This problem occurs when you do not declare at the top of your HTML file in HEDER this tag.
当您没有在 HEDER 中的 HTML 文件顶部声明此标记时,会出现此问题。
<link rel="icon" href="your_address_icon" type="image/x-icon">
回答by Panama Hyman
I had a weird situation. Mine was working fine and all of sudden stopped with that error message. I already had the header declaration. So I was dumb founded as to why it wasn't working.
我遇到了一个奇怪的情况。我的工作正常,突然停止了该错误消息。我已经有了标题声明。所以我很傻,为什么它不起作用。
<link rel="shortcut icon" href="favicon.png">
Literally nothing else on the site had an issue that I could tell. The only thing that fixedit for me was to restart my Apache service and all was good again.
从字面上看,该网站上的其他任何内容都没有我能说出来的问题。唯一为我修复它的是重新启动我的 Apache 服务,一切又好起来了。
if nothing else is working, give that a shot and see what happens.
如果没有其他工作,试一试,看看会发生什么。