Ostrzeżenie Google: zasoby interpretowane jako czcionka, ale przenoszone za pomocą aplikacji typu MIME / octet-stream

Mam ostrzeżenie w Google dla mojej font-face:

Zasób zinterpretowany jako czcionka, ale przeniesiony za pomocą typu MIME application / octet-stream: ".../ Content / Fonts / iconFont.ttf".

To działa nawet jeśli mam to Ostrzeżenie, ale wolę unikać tego ostrzeżenia.

Oto moja deklaracja:

@font-face {
  font-family: 'iconFont';
     src: url('../Fonts/iconFont.eot?#iefix') format('embedded-opentype'), 
     url('../Fonts/iconFont.svg#iconFont') format('image/svg+xml'), 
     url('../Fonts/iconFont.woff') format('font/x-woff'), 
     url('../Fonts/iconFont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

Już szukam na innych postach, ale na razie bez powodzenia.

Proszę zauważyć, że mój serwer to IIS firmy Microsoft.

Jakiś pomysł jak mogę tego uniknąć Ostrzeżenie?

Dzięki.
Author: Bronzato, 2013-03-20

7 answers

Inne podejście tutaj: http://zduck.com/2013/google-chrome-and-woff-font-mime-type-warnings/

Użyj poniższych ustawień na swojej stronie.config:

<system.webServer>
<staticContent>
  <mimeMap fileExtension=".woff" mimeType="application/font-woff"/>
</staticContent>
</system.webServer>
 13
Author: TeYoU,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-05-13 07:24:07

Musisz dodać następujące typy do an .htaccess / IIS:

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff  

Aktualizacja .woff type from:

AddType application/x-font-woff .woff

(podziękowania dla @ renadeen w komentarzach poniżej za wskazanie tego.)

Sprawdź moją odpowiedź na podobne pytanie tutaj: Font Face not loaded

Wzięte stąd: problem z czcionką w chrome.

 87
Author: 97ldave,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 12:33:47

Thanks for the above answer @97ldave, you can add these types to your IIS webServer configuration section if you wole not add them directly to your MIME types in your IIS setup. Poniżej przedstawiono przykład dodawania tylko .Typ woffa, którego brakowało w naszej konfiguracji. Naprawiono problemy z czcionkami, które nie pojawiały się w najnowszej wersji Safari (6.0.3) na moim iMac.

<system.webServer>
<staticContent>
  <remove fileExtension=".woff" />
  <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
Dzięki Jonowi Samwellowi (mojemu koledze) za odkrycie tego.
 46
Author: The Senator,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-11 08:16:24

W tym celu należy skontaktować się z Działem obsługi klienta.typy)

font/ttf                         ttf;
font/otf                         otf;
application/x-font-woff          woff;

You dont need application/vnd.ms-fontobject eot; ponieważ już istnieje.

Po ponownym uruchomieniu Nginx: service nginx restart Zrobione.
 26
Author: Steven,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-05-09 19:33:33

Poprawne typy MIME dla czcionek to:

application/font-ttf              ttf;
application/font-otf              otf;
application/font-woff             woff;
 10
Author: Sven,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-06-27 12:01:29

Jeśli uruchamiasz serwer z nodeJS, jest to miły moduł do mapowania typów mime

Https://github.com/broofa/node-mime

var mime = require('mime');

mime.lookup('/path/to/file.txt');         // => 'text/plain'
mime.lookup('file.txt');                  // => 'text/plain'
mime.lookup('.TXT');                      // => 'text/plain'
mime.lookup('htm');                       // => 'text/html'

mime.extension('text/html');                 // => 'html'
mime.extension('application/octet-stream');  // => 'bin'
 3
Author: Daan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-06-23 11:58:37

Dzięki @ the-senator i @97ldave za odpowiedzi

Dla mnie błąd całkowicie zniknie zaraz po dodaniu tych linii do sieci.config

<system.webServer>
<staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/x-font" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff2" mimeType="application/x-font" />
    </staticContent>
</system.webServer>
 1
Author: mesut,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-04-05 19:48:53