检测在网页中使用的字体 [英] Detecting which font was used in a web page

查看:132
本文介绍了检测在网页中使用的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的页面中有以下CSS规则:

Suppose I have the following CSS rule in my page:

body {
    font-family: Calibri, Trebuchet MS, Helvetica, sans-serif;
}

如何检测用户浏览器中使用的定义字体?

How can I detect which one of the defined fonts was used in the user's browser?

编辑人们不知道我为什么要这样做:我检测到的字体包含不能在其他字体中使用的字形,当用户没有字体时,我想显示一个链接,要求用户下载该字体,以便他们可以使用正确的字体来使用我的Web应用程序。

Edit for people wondering why I want to do this: The font I'm detecting contains glyph's that are not available in other fonts and when the user does not have the font I want to display a link asking the user to download that font so they can use my web application with the correct font.

目前我

推荐答案

这里是它的来源:
JavaScript / CSS字体检测器(ajaxian.com; 2007年3月12日)

这篇关于检测在网页中使用的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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