有没有办法在不受支持的浏览器中呈现SVG图标? [英] Is there a way to render SVG favicons in unsupported browsers?

查看:372
本文介绍了有没有办法在不受支持的浏览器中呈现SVG图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,似乎唯一支持它们的浏览器是Firefox.显然Opera曾经支持它,但后来放弃了它.也许是JavaScript填充程序?

As of right now, the only browser that seems to support them is Firefox. Apparently Opera used to support it but later dropped it. Perhaps a JavaScript shim?

推荐答案

我不知道有任何垫片.不幸的是,我认为没有任何可行的方法,因为图标图标显示在浏览器用户界面而不是网站本身.但是,我确实相信浏览器支持的情况终于开始有所改善.到目前为止,Firefox中的SVG图标仅在首页加载时加载,然后回退到.png.ico图标(如果有). 即将推出的Safari 9也有部分支持,将单色SVG图标用作新的固定标签"功能-但这要求SVG必须是完全黑色的,并包含非官方的mask属性,如果需要,请定义一种单色,整个图标应使用(不相关的)<meta name="theme-color">标签进行着色. Firefox似乎正在解决此问题 (更新:已在Firefox中修复41),并且所有其他浏览器都有一个用于实施SVG图标的功能请求站点( Chrome Webkit/Safari ).

I don't know of any shims. Unfortunately, I don't think there are any that would work, since a favicon is displayed in the browser user interface rather than on the website itself. However, I do believe the browser support situation is finally starting to improve. As of now, an SVG icon in Firefox only loads on the first page load, and then falls back to .png or .ico favicons if any. The upcoming Safari 9 also has partial support, with using single-colored SVG favicons for the new "pinned tabs" feature - but that requires the SVG to be completely black, have an unofficial mask attribute included, and if you want, define a single color the whole icon should be colored using the (unrelated) <meta name="theme-color"> tag. Firefox seems to be working on a fix (update: fixed in Firefox 41), and all the other browsers have a feature request site for SVG favicons to be implemented (Edge, Chrome and Webkit/Safari).

现在,除了指定<link rel="icon" sizes="any" href="favicon.svg" type="image/svg+xml">之外,还应继续指定.png和/或.ico图标.

For now, along with specifying <link rel="icon" sizes="any" href="favicon.svg" type="image/svg+xml">, you should continue specifying a .png and/or .ico icon as well.

这篇关于有没有办法在不受支持的浏览器中呈现SVG图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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