如何在HTML中显示“Reload”符号,而不通过HTTP加载图像?

时间:2022-09-04 08:17:35

I would like to display a 'refresh' symbol in an HTML/JavaScript app I'm creating, but I do not want to make any HTTP requests to load an image. How can I do this reliably across all major browsers?

我想在我正在创建的HTML/JavaScript应用程序中显示一个“refresh”符号,但是我不想发出任何HTTP请求来加载图像。如何在所有主要浏览器中可靠地实现这一点?

The closest Unicode value I could find is: ↺ (↺) But the arrow is pointing the wrong way.

我能找到的最接近的Unicode值是:↺(& # 8634;)但是箭头指向错误的方向。

Is there another Unicode value that works?

是否有另一个Unicode值可以工作?

Is there a Webdings font that works? (They don't usually work in Opera and Firefox.)

是否有一个网页字体可以使用?(他们通常不会在Opera和Firefox中工作。)

Is there a way to create an image in JS using a base64 image source provided by a String from the JavaScript?

是否有一种方法可以使用来自JavaScript的字符串提供的base64图像源在JS中创建图像?

EDIT:

编辑:

The reason for this is NOT overhead. The app being created must be self-contained in a single javascript file, without any other dependencies. It is a development utility that can be added to any project, without the need for a network.

原因不是开销。正在创建的应用程序必须包含在一个单独的javascript文件中,没有任何其他依赖项。它是一个开发工具,可以添加到任何项目中,而不需要网络。

6 个解决方案

#1


11  

If the browser supports loading image data from a Base64 string, you can use img and set its src to the following format:

如果浏览器支持从Base64字符串加载图像数据,您可以使用img并将其src设置为以下格式:

data:[<mediatype>][;base64],<data>

for example:

例如:

data:image/gif;base64,R0lGODl...

JSFiddle Demo

JSFiddle演示

#2


76  

If you find the character &#8635; (↻), i.e. U+21BB CLOCKWISE OPEN CIRCLE ARROW, acceptable for your needs (its arrow might not be placed the same way as in common reload icons), then you can use it rather safely:

如果你找到了这个角色↻(↻),即U + 21 bb顺时针开圆箭头,接受你的需要(其箭头可能不是一样放在常见的重载图标),然后你可以使用它,而安全:

<style>
.reload { font-family: Lucida Sans Unicode }
</style>

<span class=reload>&#x21bb;</span>

The Lucida Sans Unicode font contains the symbol, and it is available in virtually any Windows system you can find these days. According to MS info, it was included even in Windows 98 (and Windows 95 plus).

Lucida Sans Unicode字体包含了这个符号,现在你几乎可以在任何Windows系统中找到它。根据MS info的说法,它甚至包括在Windows 98(以及Windows 95 plus)中。

Systems other than Windows can reasonably be expected to have the symbol in some font and to have browsers that know how to pick it up from some of them. And fonts containing it have rather similar shapes for it. (But if the symbol needs to match stylistically the text of your document, you need to study the situation in more detail and try to make sure that all fonts in your font list, or “font stack”, contain it.)

除了Windows之外的系统可以合理地期望在某些字体中包含符号,并让浏览器知道如何从其中的一些字体中提取符号。包含它的字体有相当相似的形状。(但如果符号需要在文体上与文档的文本匹配,则需要更详细地研究这种情况,并确保字体列表中的所有字体(或“字体堆栈”)都包含它。)

#3


34  

Unicode Character

There are at least two Unicode characters that might serve as Refresh or Reload icons:

至少有两个Unicode字符可以作为刷新或重新加载图标:

  • CLOCKWISE GAPPED CIRCLE ARROW
    U+27F3
  • 顺时针有缺口的圆箭头U + 27 f3⟳
  • CLOCKWISE OPEN CIRCLE ARROW
    U+21BB
  • 顺时针方向开放的圆圈箭头U + 21 bb↻

The first does not appear in iOS 7 or 8 or 9 in either Safari or Chrome. So given that, and given the answer by Paul D. White, I recommend using the second one, CLOCKWISE OPEN CIRCLE ARROW.

第一个在iOS 7或8或9中没有出现在Safari或Chrome中。有了这个,有了保罗·d·怀特的答案,我建议用第二个,顺时针的圆箭头。

Tip: If you are a Mac user, obtain the free-of-cost app UnicodeChecker. You can search for characters by name, and you can see a list of fonts (on your particular Mac) containing a glyph for that character.

提示:如果你是Mac用户,可以获得免费应用UnicodeChecker。您可以按名称搜索字符,并可以看到一个字体列表(在您特定的Mac上),其中包含该字符的字形。

Icon Font

Some fonts have been created with scalable vector-based icons in place of regular character glyphs.

一些字体已经创建了可缩放的基于矢量的图标代替了常规字符符号。

#4


13  

The clockwise equivalent to your Unicode character is &#8635;, ↻ (although, as David C. Bishop notes in the comments, Chromebooks use #27f2, ⟳).

顺时针相当于你的Unicode字符& # 8635;,↻(虽然,David c .主教在评论中指出,chrome笔记本使用# 27 f2,⟳)。

Using a text character is an option, but Windows XP might not display the character (depending on the character you use, and the font you display it in). @Jukka K. Korpela notes that this character is included in the Lucida Sans Unicode font, so it should work fine even in Windows XP.

使用文本字符是一个选项,但是Windows XP可能不会显示字符(取决于您使用的字符和显示字符的字体)。@Jukka K. Korpela注意到这个字符包含在Lucida Sans Unicode字体中,因此即使在Windows XP中它也可以正常工作。

As far as Wingdings fonts go, to avoid an HTTP request you’d need to be confident that the font in question in going to be installed on end user’s computers. I don’t think there’s a common cross-platform Wingdings font (I could be entirely wrong though).

至于Wingdings字体,为了避免HTTP请求,您需要确信在最终用户的计算机上安装这种字体。我不认为有一种通用的跨平台边线字体(我可能完全错了)。

You can indeed create an image from a string that contains the base64-encoded representation of the image using JavaScript. You could do so like this:

您确实可以使用JavaScript从包含图像的base64编码表示的字符串创建图像。你可以这样做:

var image = new Image();
image.src = 'data:image/gif;base64,' + BASE64_ENCODED_STRING; // Replace gif with whatever image format it actually is

The data-uri might not work great in Internet Explorer 8 and earlier though, which Windows XP users may be stuck on. (And you don’t actually need JavaScript for this: you can just put an <img> tag in your page with that src attribute.)

data-uri在Internet Explorer 8和更早的版本中可能不能很好地工作,Windows XP用户可能会被困在其中。(实际上不需要JavaScript:只需在页面中使用src属性设置如何在HTML中显示“Reload”符号,而不通过HTTP加载图像?标记即可)。

#5


8  

Unicode 6 Character

Unicode 6字符

'CLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS' (U+1F503) ????

'CLOCKWISE向下和向上开圆ARROWS'(U+1F503)????

Sadly font support for the glyph is not the best, so "all major browsers" might be a stretch... :-/

遗憾的是,字体对字形的支持并不是最好的,所以“所有主要浏览器”可能都有点牵强。:- /

#6


3  

You mention "all major browsers", so let’s assume that:

您提到了“所有主要浏览器”,因此我们假设:

  1. not everyone have javascript
  2. 不是每个人都有javascript
  3. not everyone can embed fonts (blackberry etc)
  4. 不是每个人都能嵌入字体(黑莓等)
  5. not everyone supports all UNCODE representations (windows XP)
  6. 不是每个人都支持所有的UNCODE表示(windows XP)
  7. not everyone supports inline data uri’s (IE7-)
  8. 不是每个人都支持内联数据uri (IE7-)

So what’s left? I would suggest a HTML1-compliant IMG element, that will also be cached after first load:

那么剩下还有什么?我建议使用兼容html的IMG元素,在第一次加载之后也会缓存:

<img src="/refresh.gif" alt="refresh">

It will work in every single browser I know of, except LYNX and other pure text-based browsers. But they will show "refresh" instead, so that’s fine.

除了LYNX和其他纯基于文本的浏览器之外,它将适用于我所知道的所有浏览器。但是他们会显示“refresh”,所以没问题。

If you really want to avoid that extra 2bytes request for "modern" browsers, you can use conditional comments for IE7-:

如果你真的想避免对“现代”浏览器的额外2字节请求,你可以对IE7-:

<!--[if lte IE 7]>
<img src="refresh.gif" alt="refresh">
<![endif]-->

And something like this for the rest:

剩下的部分是这样的

<img src="data:image/gif;base64,..." alt="refresh">

If you’re up to something new for the newest, you can use CSS box shadows (demo):

如果你想要最新的东西,你可以使用CSS框阴影(demo):

.refresh{
    border-radius: 0;
    display: inline-block;
    width: 1px;
    height: 1px;
    box-shadow: 0px 0px rgba(0,0,0,0),0px 1px rgba(0,0,0,0),0px 2px rgba(0,0,0,0),0px 3px rgba(0,0,0,0),0px 4px rgba(0,0,0,0),0px 5px rgba(0,0,0,0),0px 6px rgba(0,0,0,0),0px 7px rgba(0,0,0,0),0px 8px rgba(0,0,0,0),0px 9px rgba(0,0,0,0),0px 10px rgba(0,0,0,0),0px 11px rgba(0,0,0,0),0px 12px rgba(0,0,0,0),0px 13px rgba(0,0,0,0),0px 14px rgba(0,0,0,0),0px 15px rgba(0,0,0,0),1px 0px rgba(0,0,0,0),1px 1px rgba(0,0,0,0),1px 2px rgba(0,0,0,0),1px 3px rgba(0,0,0,0),1px 4px rgba(0,0,0,0),1px 5px rgba(0,0,0,0),1px 6px rgba(0,0,0,0),1px 7px rgba(0,0,0,0),1px 8px rgba(0,0,0,0),1px 9px rgba(0,0,0,0),1px 10px rgba(0,0,0,0),1px 11px rgba(0,0,0,0),1px 12px rgba(0,0,0,0),1px 13px rgba(0,0,0,0),1px 14px rgba(0,0,0,0),1px 15px rgba(0,0,0,0),2px 0px rgba(0,0,0,0),2px 1px rgba(0,0,0,0),2px 2px rgba(0,0,0,0),2px 3px rgba(0,0,0,0),2px 4px rgba(0,0,0,0),2px 5px rgba(0,0,0,0.06),2px 6px rgba(0,0,0,0.55),2px 7px rgba(0,0,0,0.79),2px 8px rgba(0,0,0,0.86),2px 9px rgba(0,0,0,0.86),2px 10px rgba(0,0,0,0.65),2px 11px rgba(0,0,0,0.31),2px 12px rgba(0,0,0,0),2px 13px rgba(0,0,0,0),2px 14px rgba(0,0,0,0),2px 15px rgba(0,0,0,0),3px 0px rgba(0,0,0,0),3px 1px rgba(0,0,0,0),3px 2px rgba(0,0,0,0),3px 3px rgba(0,0,0,0),3px 4px rgba(0,0,0,0.25),3px 5px rgba(0,0,0,0.83),3px 6px rgba(0,0,0,0.86),3px 7px rgba(0,0,0,0.83),3px 8px rgba(0,0,0,0.69),3px 9px rgba(0,0,0,0.74),3px 10px rgba(0,0,0,0.86),3px 11px rgba(0,0,0,0.86),3px 12px rgba(0,0,0,0.6),3px 13px rgba(0,0,0,0.06),3px 14px rgba(0,0,0,0),3px 15px rgba(0,0,0,0),4px 0px rgba(0,0,0,0),4px 1px rgba(0,0,0,0),4px 2px rgba(0,0,0,0),4px 3px rgba(0,0,0,0.25),4px 4px rgba(0,0,0,0.83),4px 5px rgba(0,0,0,0.83),4px 6px rgba(0,0,0,0.43),4px 7px rgba(0,0,0,0),4px 8px rgba(0,0,0,0),4px 9px rgba(0,0,0,0),4px 10px rgba(0,0,0,0.13),4px 11px rgba(0,0,0,0.69),4px 12px rgba(0,0,0,0.86),4px 13px rgba(0,0,0,0.6),4px 14px rgba(0,0,0,0),4px 15px rgba(0,0,0,0),5px 0px rgba(0,0,0,0),5px 1px rgba(0,0,0,0),5px 2px rgba(0,0,0,0),5px 3px rgba(0,0,0,0.69),5px 4px rgba(0,0,0,0.86),5px 5px rgba(0,0,0,0.25),5px 6px rgba(0,0,0,0),5px 7px rgba(0,0,0,0),5px 8px rgba(0,0,0,0),5px 9px rgba(0,0,0,0),5px 10px rgba(0,0,0,0),5px 11px rgba(0,0,0,0),5px 12px rgba(0,0,0,0.69),5px 13px rgba(0,0,0,0.86),5px 14px rgba(0,0,0,0.25),5px 15px rgba(0,0,0,0),6px 0px rgba(0,0,0,0),6px 1px rgba(0,0,0,0),6px 2px rgba(0,0,0,0.13),6px 3px rgba(0,0,0,0.86),6px 4px rgba(0,0,0,0.6),6px 5px rgba(0,0,0,0),6px 6px rgba(0,0,0,0),6px 7px rgba(0,0,0,0),6px 8px rgba(0,0,0,0),6px 9px rgba(0,0,0,0),6px 10px rgba(0,0,0,0),6px 11px rgba(0,0,0,0),6px 12px rgba(0,0,0,0.13),6px 13px rgba(0,0,0,0.86),6px 14px rgba(0,0,0,0.65),6px 15px rgba(0,0,0,0),7px 0px rgba(0,0,0,0),7px 1px rgba(0,0,0,0),7px 2px rgba(0,0,0,0.43),7px 3px rgba(0,0,0,0.86),7px 4px rgba(0,0,0,0.31),7px 5px rgba(0,0,0,0),7px 6px rgba(0,0,0,0),7px 7px rgba(0,0,0,0),7px 8px rgba(0,0,0,0),7px 9px rgba(0,0,0,0),7px 10px rgba(0,0,0,0),7px 11px rgba(0,0,0,0),7px 12px rgba(0,0,0,0),7px 13px rgba(0,0,0,0.75),7px 14px rgba(0,0,0,0.83),7px 15px rgba(0,0,0,0),8px 0px rgba(0,0,0,0),8px 1px rgba(0,0,0,0.43),8px 2px rgba(0,0,0,0.69),8px 3px rgba(0,0,0,0.86),8px 4px rgba(0,0,0,0.6),8px 5px rgba(0,0,0,0.31),8px 6px rgba(0,0,0,0),8px 7px rgba(0,0,0,0),8px 8px rgba(0,0,0,0),8px 9px rgba(0,0,0,0),8px 10px rgba(0,0,0,0),8px 11px rgba(0,0,0,0),8px 12px rgba(0,0,0,0),8px 13px rgba(0,0,0,0.69),8px 14px rgba(0,0,0,0.86),8px 15px rgba(0,0,0,0),9px 0px rgba(0,0,0,0),9px 1px rgba(0,0,0,0.48),9px 2px rgba(0,0,0,0.86),9px 3px rgba(0,0,0,0.86),9px 4px rgba(0,0,0,0.86),9px 5px rgba(0,0,0,0.13),9px 6px rgba(0,0,0,0),9px 7px rgba(0,0,0,0),9px 8px rgba(0,0,0,0),9px 9px rgba(0,0,0,0),9px 10px rgba(0,0,0,0),9px 11px rgba(0,0,0,0),9px 12px rgba(0,0,0,0),9px 13px rgba(0,0,0,0.75),9px 14px rgba(0,0,0,0.83),9px 15px rgba(0,0,0,0),10px 0px rgba(0,0,0,0),10px 1px rgba(0,0,0,0),10px 2px rgba(0,0,0,0.79),10px 3px rgba(0,0,0,0.86),10px 4px rgba(0,0,0,0.6),10px 5px rgba(0,0,0,0),10px 6px rgba(0,0,0,0),10px 7px rgba(0,0,0,0),10px 8px rgba(0,0,0,0),10px 9px rgba(0,0,0,0),10px 10px rgba(0,0,0,0),10px 11px rgba(0,0,0,0),10px 12px rgba(0,0,0,0.13),10px 13px rgba(0,0,0,0.86),10px 14px rgba(0,0,0,0.65),10px 15px rgba(0,0,0,0),11px 0px rgba(0,0,0,0),11px 1px rgba(0,0,0,0),11px 2px rgba(0,0,0,0.38),11px 3px rgba(0,0,0,0.83),11px 4px rgba(0,0,0,0.06),11px 5px rgba(0,0,0,0),11px 6px rgba(0,0,0,0),11px 7px rgba(0,0,0,0),11px 8px rgba(0,0,0,0),11px 9px rgba(0,0,0,0),11px 10px rgba(0,0,0,0),11px 11px rgba(0,0,0,0),11px 12px rgba(0,0,0,0.69),11px 13px rgba(0,0,0,0.86),11px 14px rgba(0,0,0,0.25),11px 15px rgba(0,0,0,0),12px 0px rgba(0,0,0,0),12px 1px rgba(0,0,0,0),12px 2px rgba(0,0,0,0),12px 3px rgba(0,0,0,0.31),12px 4px rgba(0,0,0,0),12px 5px rgba(0,0,0,0),12px 6px rgba(0,0,0,0.25),12px 7px rgba(0,0,0,0),12px 8px rgba(0,0,0,0),12px 9px rgba(0,0,0,0),12px 10px rgba(0,0,0,0.13),12px 11px rgba(0,0,0,0.69),12px 12px rgba(0,0,0,0.86),12px 13px rgba(0,0,0,0.6),12px 14px rgba(0,0,0,0),12px 15px rgba(0,0,0,0),13px 0px rgba(0,0,0,0),13px 1px rgba(0,0,0,0),13px 2px rgba(0,0,0,0),13px 3px rgba(0,0,0,0),13px 4px rgba(0,0,0,0),13px 5px rgba(0,0,0,0.06),13px 6px rgba(0,0,0,0.83),13px 7px rgba(0,0,0,0.83),13px 8px rgba(0,0,0,0.69),13px 9px rgba(0,0,0,0.75),13px 10px rgba(0,0,0,0.86),13px 11px rgba(0,0,0,0.86),13px 12px rgba(0,0,0,0.6),13px 13px rgba(0,0,0,0.06),13px 14px rgba(0,0,0,0),13px 15px rgba(0,0,0,0),14px 0px rgba(0,0,0,0),14px 1px rgba(0,0,0,0),14px 2px rgba(0,0,0,0),14px 3px rgba(0,0,0,0),14px 4px rgba(0,0,0,0),14px 5px rgba(0,0,0,0.13),14px 6px rgba(0,0,0,0.55),14px 7px rgba(0,0,0,0.79),14px 8px rgba(0,0,0,0.86),14px 9px rgba(0,0,0,0.86),14px 10px rgba(0,0,0,0.65),14px 11px rgba(0,0,0,0.31),14px 12px rgba(0,0,0,0),14px 13px rgba(0,0,0,0),14px 14px rgba(0,0,0,0),14px 15px rgba(0,0,0,0),15px 0px rgba(0,0,0,0),15px 1px rgba(0,0,0,0),15px 2px rgba(0,0,0,0),15px 3px rgba(0,0,0,0),15px 4px rgba(0,0,0,0),15px 5px rgba(0,0,0,0),15px 6px rgba(0,0,0,0),15px 7px rgba(0,0,0,0),15px 8px rgba(0,0,0,0),15px 9px rgba(0,0,0,0),15px 10px rgba(0,0,0,0),15px 11px rgba(0,0,0,0),15px 12px rgba(0,0,0,0),15px 13px rgba(0,0,0,0),15px 14px rgba(0,0,0,0),15px 15px rgba(0,0,0,0);
}

#1


11  

If the browser supports loading image data from a Base64 string, you can use img and set its src to the following format:

如果浏览器支持从Base64字符串加载图像数据,您可以使用img并将其src设置为以下格式:

data:[<mediatype>][;base64],<data>

for example:

例如:

data:image/gif;base64,R0lGODl...

JSFiddle Demo

JSFiddle演示

#2


76  

If you find the character &#8635; (↻), i.e. U+21BB CLOCKWISE OPEN CIRCLE ARROW, acceptable for your needs (its arrow might not be placed the same way as in common reload icons), then you can use it rather safely:

如果你找到了这个角色↻(↻),即U + 21 bb顺时针开圆箭头,接受你的需要(其箭头可能不是一样放在常见的重载图标),然后你可以使用它,而安全:

<style>
.reload { font-family: Lucida Sans Unicode }
</style>

<span class=reload>&#x21bb;</span>

The Lucida Sans Unicode font contains the symbol, and it is available in virtually any Windows system you can find these days. According to MS info, it was included even in Windows 98 (and Windows 95 plus).

Lucida Sans Unicode字体包含了这个符号,现在你几乎可以在任何Windows系统中找到它。根据MS info的说法,它甚至包括在Windows 98(以及Windows 95 plus)中。

Systems other than Windows can reasonably be expected to have the symbol in some font and to have browsers that know how to pick it up from some of them. And fonts containing it have rather similar shapes for it. (But if the symbol needs to match stylistically the text of your document, you need to study the situation in more detail and try to make sure that all fonts in your font list, or “font stack”, contain it.)

除了Windows之外的系统可以合理地期望在某些字体中包含符号,并让浏览器知道如何从其中的一些字体中提取符号。包含它的字体有相当相似的形状。(但如果符号需要在文体上与文档的文本匹配,则需要更详细地研究这种情况,并确保字体列表中的所有字体(或“字体堆栈”)都包含它。)

#3


34  

Unicode Character

There are at least two Unicode characters that might serve as Refresh or Reload icons:

至少有两个Unicode字符可以作为刷新或重新加载图标:

  • CLOCKWISE GAPPED CIRCLE ARROW
    U+27F3
  • 顺时针有缺口的圆箭头U + 27 f3⟳
  • CLOCKWISE OPEN CIRCLE ARROW
    U+21BB
  • 顺时针方向开放的圆圈箭头U + 21 bb↻

The first does not appear in iOS 7 or 8 or 9 in either Safari or Chrome. So given that, and given the answer by Paul D. White, I recommend using the second one, CLOCKWISE OPEN CIRCLE ARROW.

第一个在iOS 7或8或9中没有出现在Safari或Chrome中。有了这个,有了保罗·d·怀特的答案,我建议用第二个,顺时针的圆箭头。

Tip: If you are a Mac user, obtain the free-of-cost app UnicodeChecker. You can search for characters by name, and you can see a list of fonts (on your particular Mac) containing a glyph for that character.

提示:如果你是Mac用户,可以获得免费应用UnicodeChecker。您可以按名称搜索字符,并可以看到一个字体列表(在您特定的Mac上),其中包含该字符的字形。

Icon Font

Some fonts have been created with scalable vector-based icons in place of regular character glyphs.

一些字体已经创建了可缩放的基于矢量的图标代替了常规字符符号。

#4


13  

The clockwise equivalent to your Unicode character is &#8635;, ↻ (although, as David C. Bishop notes in the comments, Chromebooks use #27f2, ⟳).

顺时针相当于你的Unicode字符& # 8635;,↻(虽然,David c .主教在评论中指出,chrome笔记本使用# 27 f2,⟳)。

Using a text character is an option, but Windows XP might not display the character (depending on the character you use, and the font you display it in). @Jukka K. Korpela notes that this character is included in the Lucida Sans Unicode font, so it should work fine even in Windows XP.

使用文本字符是一个选项,但是Windows XP可能不会显示字符(取决于您使用的字符和显示字符的字体)。@Jukka K. Korpela注意到这个字符包含在Lucida Sans Unicode字体中,因此即使在Windows XP中它也可以正常工作。

As far as Wingdings fonts go, to avoid an HTTP request you’d need to be confident that the font in question in going to be installed on end user’s computers. I don’t think there’s a common cross-platform Wingdings font (I could be entirely wrong though).

至于Wingdings字体,为了避免HTTP请求,您需要确信在最终用户的计算机上安装这种字体。我不认为有一种通用的跨平台边线字体(我可能完全错了)。

You can indeed create an image from a string that contains the base64-encoded representation of the image using JavaScript. You could do so like this:

您确实可以使用JavaScript从包含图像的base64编码表示的字符串创建图像。你可以这样做:

var image = new Image();
image.src = 'data:image/gif;base64,' + BASE64_ENCODED_STRING; // Replace gif with whatever image format it actually is

The data-uri might not work great in Internet Explorer 8 and earlier though, which Windows XP users may be stuck on. (And you don’t actually need JavaScript for this: you can just put an <img> tag in your page with that src attribute.)

data-uri在Internet Explorer 8和更早的版本中可能不能很好地工作,Windows XP用户可能会被困在其中。(实际上不需要JavaScript:只需在页面中使用src属性设置如何在HTML中显示“Reload”符号,而不通过HTTP加载图像?标记即可)。

#5


8  

Unicode 6 Character

Unicode 6字符

'CLOCKWISE DOWNWARDS AND UPWARDS OPEN CIRCLE ARROWS' (U+1F503) ????

'CLOCKWISE向下和向上开圆ARROWS'(U+1F503)????

Sadly font support for the glyph is not the best, so "all major browsers" might be a stretch... :-/

遗憾的是,字体对字形的支持并不是最好的,所以“所有主要浏览器”可能都有点牵强。:- /

#6


3  

You mention "all major browsers", so let’s assume that:

您提到了“所有主要浏览器”,因此我们假设:

  1. not everyone have javascript
  2. 不是每个人都有javascript
  3. not everyone can embed fonts (blackberry etc)
  4. 不是每个人都能嵌入字体(黑莓等)
  5. not everyone supports all UNCODE representations (windows XP)
  6. 不是每个人都支持所有的UNCODE表示(windows XP)
  7. not everyone supports inline data uri’s (IE7-)
  8. 不是每个人都支持内联数据uri (IE7-)

So what’s left? I would suggest a HTML1-compliant IMG element, that will also be cached after first load:

那么剩下还有什么?我建议使用兼容html的IMG元素,在第一次加载之后也会缓存:

<img src="/refresh.gif" alt="refresh">

It will work in every single browser I know of, except LYNX and other pure text-based browsers. But they will show "refresh" instead, so that’s fine.

除了LYNX和其他纯基于文本的浏览器之外,它将适用于我所知道的所有浏览器。但是他们会显示“refresh”,所以没问题。

If you really want to avoid that extra 2bytes request for "modern" browsers, you can use conditional comments for IE7-:

如果你真的想避免对“现代”浏览器的额外2字节请求,你可以对IE7-:

<!--[if lte IE 7]>
<img src="refresh.gif" alt="refresh">
<![endif]-->

And something like this for the rest:

剩下的部分是这样的

<img src="data:image/gif;base64,..." alt="refresh">

If you’re up to something new for the newest, you can use CSS box shadows (demo):

如果你想要最新的东西,你可以使用CSS框阴影(demo):

.refresh{
    border-radius: 0;
    display: inline-block;
    width: 1px;
    height: 1px;
    box-shadow: 0px 0px rgba(0,0,0,0),0px 1px rgba(0,0,0,0),0px 2px rgba(0,0,0,0),0px 3px rgba(0,0,0,0),0px 4px rgba(0,0,0,0),0px 5px rgba(0,0,0,0),0px 6px rgba(0,0,0,0),0px 7px rgba(0,0,0,0),0px 8px rgba(0,0,0,0),0px 9px rgba(0,0,0,0),0px 10px rgba(0,0,0,0),0px 11px rgba(0,0,0,0),0px 12px rgba(0,0,0,0),0px 13px rgba(0,0,0,0),0px 14px rgba(0,0,0,0),0px 15px rgba(0,0,0,0),1px 0px rgba(0,0,0,0),1px 1px rgba(0,0,0,0),1px 2px rgba(0,0,0,0),1px 3px rgba(0,0,0,0),1px 4px rgba(0,0,0,0),1px 5px rgba(0,0,0,0),1px 6px rgba(0,0,0,0),1px 7px rgba(0,0,0,0),1px 8px rgba(0,0,0,0),1px 9px rgba(0,0,0,0),1px 10px rgba(0,0,0,0),1px 11px rgba(0,0,0,0),1px 12px rgba(0,0,0,0),1px 13px rgba(0,0,0,0),1px 14px rgba(0,0,0,0),1px 15px rgba(0,0,0,0),2px 0px rgba(0,0,0,0),2px 1px rgba(0,0,0,0),2px 2px rgba(0,0,0,0),2px 3px rgba(0,0,0,0),2px 4px rgba(0,0,0,0),2px 5px rgba(0,0,0,0.06),2px 6px rgba(0,0,0,0.55),2px 7px rgba(0,0,0,0.79),2px 8px rgba(0,0,0,0.86),2px 9px rgba(0,0,0,0.86),2px 10px rgba(0,0,0,0.65),2px 11px rgba(0,0,0,0.31),2px 12px rgba(0,0,0,0),2px 13px rgba(0,0,0,0),2px 14px rgba(0,0,0,0),2px 15px rgba(0,0,0,0),3px 0px rgba(0,0,0,0),3px 1px rgba(0,0,0,0),3px 2px rgba(0,0,0,0),3px 3px rgba(0,0,0,0),3px 4px rgba(0,0,0,0.25),3px 5px rgba(0,0,0,0.83),3px 6px rgba(0,0,0,0.86),3px 7px rgba(0,0,0,0.83),3px 8px rgba(0,0,0,0.69),3px 9px rgba(0,0,0,0.74),3px 10px rgba(0,0,0,0.86),3px 11px rgba(0,0,0,0.86),3px 12px rgba(0,0,0,0.6),3px 13px rgba(0,0,0,0.06),3px 14px rgba(0,0,0,0),3px 15px rgba(0,0,0,0),4px 0px rgba(0,0,0,0),4px 1px rgba(0,0,0,0),4px 2px rgba(0,0,0,0),4px 3px rgba(0,0,0,0.25),4px 4px rgba(0,0,0,0.83),4px 5px rgba(0,0,0,0.83),4px 6px rgba(0,0,0,0.43),4px 7px rgba(0,0,0,0),4px 8px rgba(0,0,0,0),4px 9px rgba(0,0,0,0),4px 10px rgba(0,0,0,0.13),4px 11px rgba(0,0,0,0.69),4px 12px rgba(0,0,0,0.86),4px 13px rgba(0,0,0,0.6),4px 14px rgba(0,0,0,0),4px 15px rgba(0,0,0,0),5px 0px rgba(0,0,0,0),5px 1px rgba(0,0,0,0),5px 2px rgba(0,0,0,0),5px 3px rgba(0,0,0,0.69),5px 4px rgba(0,0,0,0.86),5px 5px rgba(0,0,0,0.25),5px 6px rgba(0,0,0,0),5px 7px rgba(0,0,0,0),5px 8px rgba(0,0,0,0),5px 9px rgba(0,0,0,0),5px 10px rgba(0,0,0,0),5px 11px rgba(0,0,0,0),5px 12px rgba(0,0,0,0.69),5px 13px rgba(0,0,0,0.86),5px 14px rgba(0,0,0,0.25),5px 15px rgba(0,0,0,0),6px 0px rgba(0,0,0,0),6px 1px rgba(0,0,0,0),6px 2px rgba(0,0,0,0.13),6px 3px rgba(0,0,0,0.86),6px 4px rgba(0,0,0,0.6),6px 5px rgba(0,0,0,0),6px 6px rgba(0,0,0,0),6px 7px rgba(0,0,0,0),6px 8px rgba(0,0,0,0),6px 9px rgba(0,0,0,0),6px 10px rgba(0,0,0,0),6px 11px rgba(0,0,0,0),6px 12px rgba(0,0,0,0.13),6px 13px rgba(0,0,0,0.86),6px 14px rgba(0,0,0,0.65),6px 15px rgba(0,0,0,0),7px 0px rgba(0,0,0,0),7px 1px rgba(0,0,0,0),7px 2px rgba(0,0,0,0.43),7px 3px rgba(0,0,0,0.86),7px 4px rgba(0,0,0,0.31),7px 5px rgba(0,0,0,0),7px 6px rgba(0,0,0,0),7px 7px rgba(0,0,0,0),7px 8px rgba(0,0,0,0),7px 9px rgba(0,0,0,0),7px 10px rgba(0,0,0,0),7px 11px rgba(0,0,0,0),7px 12px rgba(0,0,0,0),7px 13px rgba(0,0,0,0.75),7px 14px rgba(0,0,0,0.83),7px 15px rgba(0,0,0,0),8px 0px rgba(0,0,0,0),8px 1px rgba(0,0,0,0.43),8px 2px rgba(0,0,0,0.69),8px 3px rgba(0,0,0,0.86),8px 4px rgba(0,0,0,0.6),8px 5px rgba(0,0,0,0.31),8px 6px rgba(0,0,0,0),8px 7px rgba(0,0,0,0),8px 8px rgba(0,0,0,0),8px 9px rgba(0,0,0,0),8px 10px rgba(0,0,0,0),8px 11px rgba(0,0,0,0),8px 12px rgba(0,0,0,0),8px 13px rgba(0,0,0,0.69),8px 14px rgba(0,0,0,0.86),8px 15px rgba(0,0,0,0),9px 0px rgba(0,0,0,0),9px 1px rgba(0,0,0,0.48),9px 2px rgba(0,0,0,0.86),9px 3px rgba(0,0,0,0.86),9px 4px rgba(0,0,0,0.86),9px 5px rgba(0,0,0,0.13),9px 6px rgba(0,0,0,0),9px 7px rgba(0,0,0,0),9px 8px rgba(0,0,0,0),9px 9px rgba(0,0,0,0),9px 10px rgba(0,0,0,0),9px 11px rgba(0,0,0,0),9px 12px rgba(0,0,0,0),9px 13px rgba(0,0,0,0.75),9px 14px rgba(0,0,0,0.83),9px 15px rgba(0,0,0,0),10px 0px rgba(0,0,0,0),10px 1px rgba(0,0,0,0),10px 2px rgba(0,0,0,0.79),10px 3px rgba(0,0,0,0.86),10px 4px rgba(0,0,0,0.6),10px 5px rgba(0,0,0,0),10px 6px rgba(0,0,0,0),10px 7px rgba(0,0,0,0),10px 8px rgba(0,0,0,0),10px 9px rgba(0,0,0,0),10px 10px rgba(0,0,0,0),10px 11px rgba(0,0,0,0),10px 12px rgba(0,0,0,0.13),10px 13px rgba(0,0,0,0.86),10px 14px rgba(0,0,0,0.65),10px 15px rgba(0,0,0,0),11px 0px rgba(0,0,0,0),11px 1px rgba(0,0,0,0),11px 2px rgba(0,0,0,0.38),11px 3px rgba(0,0,0,0.83),11px 4px rgba(0,0,0,0.06),11px 5px rgba(0,0,0,0),11px 6px rgba(0,0,0,0),11px 7px rgba(0,0,0,0),11px 8px rgba(0,0,0,0),11px 9px rgba(0,0,0,0),11px 10px rgba(0,0,0,0),11px 11px rgba(0,0,0,0),11px 12px rgba(0,0,0,0.69),11px 13px rgba(0,0,0,0.86),11px 14px rgba(0,0,0,0.25),11px 15px rgba(0,0,0,0),12px 0px rgba(0,0,0,0),12px 1px rgba(0,0,0,0),12px 2px rgba(0,0,0,0),12px 3px rgba(0,0,0,0.31),12px 4px rgba(0,0,0,0),12px 5px rgba(0,0,0,0),12px 6px rgba(0,0,0,0.25),12px 7px rgba(0,0,0,0),12px 8px rgba(0,0,0,0),12px 9px rgba(0,0,0,0),12px 10px rgba(0,0,0,0.13),12px 11px rgba(0,0,0,0.69),12px 12px rgba(0,0,0,0.86),12px 13px rgba(0,0,0,0.6),12px 14px rgba(0,0,0,0),12px 15px rgba(0,0,0,0),13px 0px rgba(0,0,0,0),13px 1px rgba(0,0,0,0),13px 2px rgba(0,0,0,0),13px 3px rgba(0,0,0,0),13px 4px rgba(0,0,0,0),13px 5px rgba(0,0,0,0.06),13px 6px rgba(0,0,0,0.83),13px 7px rgba(0,0,0,0.83),13px 8px rgba(0,0,0,0.69),13px 9px rgba(0,0,0,0.75),13px 10px rgba(0,0,0,0.86),13px 11px rgba(0,0,0,0.86),13px 12px rgba(0,0,0,0.6),13px 13px rgba(0,0,0,0.06),13px 14px rgba(0,0,0,0),13px 15px rgba(0,0,0,0),14px 0px rgba(0,0,0,0),14px 1px rgba(0,0,0,0),14px 2px rgba(0,0,0,0),14px 3px rgba(0,0,0,0),14px 4px rgba(0,0,0,0),14px 5px rgba(0,0,0,0.13),14px 6px rgba(0,0,0,0.55),14px 7px rgba(0,0,0,0.79),14px 8px rgba(0,0,0,0.86),14px 9px rgba(0,0,0,0.86),14px 10px rgba(0,0,0,0.65),14px 11px rgba(0,0,0,0.31),14px 12px rgba(0,0,0,0),14px 13px rgba(0,0,0,0),14px 14px rgba(0,0,0,0),14px 15px rgba(0,0,0,0),15px 0px rgba(0,0,0,0),15px 1px rgba(0,0,0,0),15px 2px rgba(0,0,0,0),15px 3px rgba(0,0,0,0),15px 4px rgba(0,0,0,0),15px 5px rgba(0,0,0,0),15px 6px rgba(0,0,0,0),15px 7px rgba(0,0,0,0),15px 8px rgba(0,0,0,0),15px 9px rgba(0,0,0,0),15px 10px rgba(0,0,0,0),15px 11px rgba(0,0,0,0),15px 12px rgba(0,0,0,0),15px 13px rgba(0,0,0,0),15px 14px rgba(0,0,0,0),15px 15px rgba(0,0,0,0);
}