为什么图标不可见 [英] Why is favicon not visible

查看:206
本文介绍了为什么图标不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,它允许根据网址来显示网站图示:

I have a script which allows to display favicons based on the url: Example

如果你看一下例子,你会看到两个环节,一个连接到谷歌和其他当红荷兰新闻网站。正如你所看到的谷歌图标是由脚本检索,而另一个则不是。这怎么可能?是什么原因造成的?如果我去的网站,我可以看到他们有一个图标。我可以在code更改为检索该图标?

If you look at the example you will see two links, one linking to Google and the other to a popular dutch news website. As you can see the Google favicon is retrieved by the script while the other is not. How is this possible? What is causing this? If I go to the website I can see they do have a favicon. What can I change in the code to retrieve this favicon?

推荐答案

由于图标为nu.nl下 http://www.nu.nl/images/favicon.ico

Because favicon for nu.nl is stored under http://www.nu.nl/images/favicon.ico

检查出快速和肮脏的解决方案: http://jsbin.com/eselap/2/edit,里面有硬codeD的URL。理想情况下,你应该请求的页面,解析它,发现图标​​的网址。

Check out quick and dirty solution: http://jsbin.com/eselap/2/edit, which has hardcoded URLs. Ideally, you should request the page, parse it and find URL of favicon.

这篇关于为什么图标不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆