Google Material Icons (Schriftart) wird in Mozilla Firefox nicht gerendert

Lesezeit: 1 Minute

Benutzer-Avatar
tej ethisch

Ich versuche, Google-Materialsymbole zu meinem WordPress-Projekt lokal hinzuzufügen, derzeit auf localhost mit WAMP. Mit CDNalles funktioniert perfekt, aber ich möchte einen statischen Verweis auf Symbole.

Hier ist meine Verzeichnisstruktur

/
-index.php
-css/
----style.min.css
----MaterialIcons-Regular.eot
----MaterialIcons-Regular.ttf
----MaterialIcons-Regular.woff
----MaterialIcons-Regular.woff2

Im style.min.css Ich habe:

.material-icons{
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;  /* Preferred icon size */
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;

  /* Support for all WebKit browsers. */
  -webkit-font-smoothing: antialiased;
  /* Support for Safari and Chrome. */
  text-rendering: optimizeLegibility;

  /* Support for Firefox. */
  -moz-osx-font-smoothing: grayscale;

  /* Support for IE. */
  font-feature-settings: 'liga';

}


@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
  src: local('Material Icons'),
       local('MaterialIcons-Regular'),
       url(MaterialIcons-Regular.woff2) format('woff2'),
       url(MaterialIcons-Regular.woff) format('woff'),
       url(MaterialIcons-Regular.ttf) format('truetype');
}

Wenn ich Symbole im Körper verwende als:

<i class="material-icons">&#xE853;</i>

Die Symbole werden in Chrome gut wiedergegeben, aber nicht in Firefox.
FeuerBug zeigt diesen Fehler

Cross-Origin Request Blocked: The Same Origin Policy disallows reading
the remote resource athttp://192.168.0.8/wp/wp-content/themes/thediode/css/MaterialIcons-Regular.woff2. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

192.168.0.8/wp ist das Root-Set im WordPress-Backend auf localhost, damit Bilder und andere Ressourcen ordnungsgemäß abgerufen werden, und ich denke, das ist das Problem. Irgendwelche Ideen? wird das funktionieren, wenn live?

Gehen Sie in Ihrer URL-Leiste in FF zu about:config. Finden security.fileuri.strict_origin_policy und auf false setzen.

ODER

Könnte ein Problem mit dem Dateipfad sein. Versuchen Sie, einen Schrägstrich hinzuzufügen:

 url("/MaterialIcons-Regular.woff2")

1377630cookie-checkGoogle Material Icons (Schriftart) wird in Mozilla Firefox nicht gerendert

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy