Frage

Ich würde gerne wissen, ob es möglich ist, WebFonts auf einer anderen Domäne zu hosten, Meine CSS werden in Amazon Cloudfront und meine Webfonts gehostet, aber sie zeigen nicht, es war in Ordnung, als meine CSS in lokal waren.

Dies ist mein style.css auf cloudfront: generasacodicetagpre.

Das Stylesheet wird auf Cloudfront mithilfe eines Subdomains gehostet: static.mydomain.com/style.css Und die Webfont kann heruntergeladen werden von: static.mydomain.com/app/files/fonts/allerdisplay-webfont.ttf

Wenn das Stylesheet von myDomain.com angerufen wird, lädt es es nicht.Ich habe mich gefragt, ob es eine Begrenzung oder so etwas ist.

danke

War es hilfreich?

Lösung

Should be no problem with an absolute path for the URL in the style declaration.

In your code above, you have relative path URLs.
You need an absolute path URL, like:

"http://static.mydomain.com/app/files/fonts/allerdisplay-webfont.ttf" (absolute)

-- not --

"/app/files/fonts/allerdisplay-webfont.ttf" (relative)

Theoretically, depending on the architecture of your subdomain, you might be able to rig up a way to maintain a relative URL, but this would not be worth the trouble. Just use an absolute one and be done with it.

[previous suggestions below were posted before the relevant code was posted] But Google Web Fonts achieves all this by moving the entire style sheet to the cloud. If you can't get it running inside the style sheet, you might try creating a separate style sheet like that instead.

Note, however, that to get true cross-browser compatibility, you need a bunch of different font file formats... this could be the problem. FontSquirrel has a font kit generator you may want to check out for that.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top