开发者

Page freeze while loading fonts

I have a heavy internet page who freezes when I add the "@font-face" clause in its CSS. Everything seems to be loaded, but I don't see most of the page (I can select the text and paste it somewhere, but it won't appear on the page itself). The font download seems to fail (based on tests with "AOL Pagetest" plugin). After a lot of tests, it seems like it's a timing thing. I added a sort of "Sleep" function in javascript and the page now loads most of the time, but still freezes sometimes! It seems like the page tries to show before the font is fully downloaded, which freezes the interface.

Do you have any suggestion on how I could treat this problem in a better way than putting a Sleep of 2 seconds, because I don't find it really clean to do this, and, as the css of the page can be modified by the user, I don't have the control on how much fonts will ne开发者_Python百科ed to be downloaded from the server and how heavy these files could be..!

Thank you


There are IE behavior reasons for putting font imports directly in your document <head> instead of in separate imported .CSS files. I'll see if I can track down the reference I read about this.

  • Here's a good blog post from Steve Souders, with some links to other relevant references
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜