有大佬能解释一下,浏览器访问一张网络图片,为什么会有favicon?
附带图片链接: https://zos.alipayobjects.com...
有大佬能解释一下,浏览器访问一张网络图片,为什么会有favicon?
附带图片链接: https://zos.alipayobjects.com...
favicon 一般可以通过 <head>
里的 <link rel="icon">
来指定。
没有的话:
In the absence of a link with the icon keyword, for Document objects obtained over HTTP or HTTPS, user agents may instead run these steps in parallel:
- Let request be a new request whose URL is the absolute URL obtained by resolving the URL "/favicon.ico" against the document’s URL, client is the Document object’s Window object’s environment settings object, type is "image", destination is "subresource", synchronous flag is set, credentials mode is "include", and whose use-URL-credentials flag is set.
- Let response be the result of fetching request.
- Use response’s unsafe response as an icon as if it had been declared using the icon keyword.
也就是会去拼一个 /favicon.ico
的 url 出来请求 favicon 。
2 回答2k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
3 回答1.7k 阅读
1 回答1.1k 阅读✓ 已解决
2 回答1k 阅读✓ 已解决
2 回答1.6k 阅读
2 回答513 阅读✓ 已解决
浏览器在服务器根目录下查找favicon.ico,找到就会添加在网页title左侧,没找到的话就404