caching font-face fonts

后端 未结 1 735
别跟我提以往
别跟我提以往 2021-02-07 12:17

I\'m using @font-face to embed a font hosted on TypeFront, but my font is not cached by the browser (Firefox 3.6.13 and Epiphany 2.30.2). This is causing a FOUC (Flash of Unstyl

相关标签:
1条回答
  • 2021-02-07 12:39

    UPDATE Nov-2016: The Coral content distribution network, described below, is no longer in operation.


    This is a rather generic "solution". There is a production service, operating since years, open to the public (though check their terms for commercial use, I don't know if it fits). It is a US federally funded research project in a content distribution network.

    It is called Coral and works by appending .nyud.net to any URL, for example

    http://www.example.com/static/MyFont.ttf
    

    becomes

    http://www.example.com.nyud.net/static/MyFont.ttf.
    

    There is nothing else to do. On the first request, the Coral servers fetch and cache the file (expect some delay), and then they serve it without checking again (they only check infrequently for new versions).

    It is using an advanced DNS extension, DNAME records, so it might not work with very old operating systems or DNS resolvers, though anything reasonably recent is known to work. This way, requests are routed to a geographically close server.

    0 讨论(0)
提交回复
热议问题