Degrading Unicode characters for web browsers with missing fonts

前端 未结 4 1628
甜味超标
甜味超标 2021-02-18 22:01

I am using the Unicode \'CHECK MARK\' (U+2713) in a html document. I find that it renders OK in most browsers, but occasionally I encounter someone with a missing font on their

4条回答
  •  借酒劲吻你
    2021-02-18 22:57

    If you can devise a way to remotely check if MS Office 2000 or newer is installed, you should be able to assume that Arial Unicode MS is installed and hence having this code point in a font (as long as you have the CSS font family set to something like "Arial Unicode MS, Arial, sans-serif").

    I believe this will only work in Microsoft Internet Explorer, but you should be able to detect a Word installation by trying to create its ActiveX object in JavaScript:

    if(new ActiveXObject("Word.Application"))
    {
        window.alert("Word is installed, go ahead and use the Unicode check mark in HTML");
    }
    else
    {
        window.alert("Word is not installed, use your image of a check mark.");
    }
    

    But given that this really only works in IE, will probably throw a security warning in IE8, and you still need a fallback mechanism for other browsers or IE browsers without MS Office, using an image all the time is probably the best way to go.

提交回复
热议问题