Font Awesome all.js 文件在 ie9 中不工作
Font Awesome all.js file not working in ie9
我下载了 pro fontawesome 文件以在我的网络应用程序中使用。我无法使用 CDN。我已正确插入 all.js 文件,因为它在 ie11 和所有其他浏览器中工作正常。我需要它也能在 ie9 中工作。它在 ie9 中使用 CDN 确实有效,但我无法使用 CDN 部署站点。有什么建议么?
根据您的描述,我尝试下载字体真棒文件并在我的应用程序中使用。在IE9浏览器中,使用all.js时,会显示"Unable to get property 'add' of undefined or null reference"错误。这个问题与 IE9 不支持 classList
有关,所以我们需要一个像 classList.js 这样的 polyfill。然后,您可以使用 font awesome 文件引用,而不是使用 CDN 引用。
这样的代码:
<head>
<title>Font Awesome 5 Icons</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href="fontawesome/css/all.css" rel="stylesheet" />
<script src="classList.min.js"></script> <!--https://cdnjs.cloudflare.com/ajax/libs/classlist/1.2.20171210/classList.min.js-->
<script src="polyfill.classList.min.js"></script> <!--https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js-->
<script src="fontawesome/js/all.js"></script>
</head>
<body>
<h1>fas fa-tty</h1>
<i class='fas fa-tty'></i>
<i class='fas fa-tty' style='font-size:24px'></i>
<i class='fas fa-tty' style='font-size:36px'></i>
<i class='fas fa-tty' style='font-size:48px;color:red'></i>
<br>
<span style="font-size: 3em; color: Tomato;">
<i class="fas fa-igloo"></i>
</span>
<span style="font-size: 48px; color: Dodgerblue;">
<i class="fas fa-igloo"></i>
</span>
<span style="font-size: 3rem;">
<span style="color: Mediumslateblue;">
<i class="fas fa-igloo"></i>
</span>
</span>
</body>
结果(使用F12改成IE 9):
我下载了 pro fontawesome 文件以在我的网络应用程序中使用。我无法使用 CDN。我已正确插入 all.js 文件,因为它在 ie11 和所有其他浏览器中工作正常。我需要它也能在 ie9 中工作。它在 ie9 中使用 CDN 确实有效,但我无法使用 CDN 部署站点。有什么建议么?
根据您的描述,我尝试下载字体真棒文件并在我的应用程序中使用。在IE9浏览器中,使用all.js时,会显示"Unable to get property 'add' of undefined or null reference"错误。这个问题与 IE9 不支持 classList
有关,所以我们需要一个像 classList.js 这样的 polyfill。然后,您可以使用 font awesome 文件引用,而不是使用 CDN 引用。
这样的代码:
<head>
<title>Font Awesome 5 Icons</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href="fontawesome/css/all.css" rel="stylesheet" />
<script src="classList.min.js"></script> <!--https://cdnjs.cloudflare.com/ajax/libs/classlist/1.2.20171210/classList.min.js-->
<script src="polyfill.classList.min.js"></script> <!--https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js-->
<script src="fontawesome/js/all.js"></script>
</head>
<body>
<h1>fas fa-tty</h1>
<i class='fas fa-tty'></i>
<i class='fas fa-tty' style='font-size:24px'></i>
<i class='fas fa-tty' style='font-size:36px'></i>
<i class='fas fa-tty' style='font-size:48px;color:red'></i>
<br>
<span style="font-size: 3em; color: Tomato;">
<i class="fas fa-igloo"></i>
</span>
<span style="font-size: 48px; color: Dodgerblue;">
<i class="fas fa-igloo"></i>
</span>
<span style="font-size: 3rem;">
<span style="color: Mediumslateblue;">
<i class="fas fa-igloo"></i>
</span>
</span>
</body>
结果(使用F12改成IE 9):