Why does my @font-face declaration display an incorrect MIME type in Chrome?

Susan Sarandon
Release: 2024-10-25 22:28:02
Original
748 people have browsed it

Why does my @font-face declaration display an incorrect MIME type in Chrome?

'font-face' Declaration Displays Incorrect MIME Type in Chrome

When using the below @font-face declaration:

<code class="css">@font-face {
    font-family: SolaimanLipi;
    src: url("font/SolaimanLipi_20-04-07.ttf");
}</code>
Copy after login

it functions flawlessly in Firefox but fails in Chrome. Upon inspecting the element, the following message appears:

Resource interpreted as font but transferred with MIME type application/octet-stream.
Copy after login

To address this cross-browser compatibility issue, consider the versatile @font-face declaration suggested by Paul Irish:

<code class="css">@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot');
  src: local('☺'),
         url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');
}</code>
Copy after login

This declaration caters to different browsers by offering:

  • .eot for Internet Explorer
  • .woff or .ttf for other browsers

To generate these font types from the original source, utilize Font Squirrel's font face generator.

Additionally, add an .htaccess file to define the font types:

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
Copy after login

The above is the detailed content of Why does my @font-face declaration display an incorrect MIME type in Chrome?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!