8

as you can see in the screenshot the icons and the font are not loaded correctly.

enter image description here

Our observation is that this only does not work in Safari. No matter if we are testing on iPhone or on a Mac.

The fonts are loaded as follows:

<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />

Any other Browser we tested displays the icons and font correctly. (Google Browser on iOS; Chrome on Windows)

From what we see in the Safari Debugger it seems that the font files can't be downloaded. (I didn't want to write this but: Sometimes i have observed that it works for a short time and then stops working.)

In Chrome the result looks like this:

enter image description here

What would be the suggestion?

  • Self Hosting? Why?

Update 2019-11-13: Found additional information at: https://github.com/doanythingfordethklok/safari-cache-bug

Daniel
  • 9,491
  • 12
  • 50
  • 66

4 Answers4

3

You seem to be running into exactly the bug you've updated your post with.

Are you perhaps redirecting the user a bunch of times on initial app load? If so the safest bet would be to wait for actual user input before starting any redirects, this will also ensure everything has been loaded properly.

An alternative approach would be to wait for the document to become ready via (i.e. jQuery's) document.ready function:

$(document).ready(function() {
    // your code here
});

You could try putting your code there or, alternatively, wait for user input until initiating the redirects. I personally didn't have any luck with the document.ready approach and switched to the user input method.

Daniel
  • 9,491
  • 12
  • 50
  • 66
Jejuni
  • 1,034
  • 1
  • 8
  • 13
1

One of below methods might be helpful to fix this font loading issue in Safari browser.

I have inspected above linked google font source codes and attached two screens here. Please note that only .woff2 font file format is linked.


This is the screen of google 'Roboto' font source code.

enter image description here


This is the screen of google 'Icon' font source code.

enter image description here


I found that .woff2 format is not fully supported by all Safari versions. Safari versions below the 9.1 don't support for .woff2, while that is partially and fully supported by safari versions.

Below I have attached a screen for your reference.

enter image description here

  • Red - Not Supported.
  • Light Green - Partially supported.
  • Dark Green - Fully Supported.

I think Safari version of your device stands between 3.1 - 11.1.


Fix

First you need to download your font file and then need to upload and transform that font file to .ttf, .eot, .woff, .woff2 formats using Transfonter official site. Please make sure to check above file formats you needed to have before click 'convert' button.

Once you download and extract compressed file, you will able to see, there are all converted files and a css style sheet. Keep all of them together and linked that CSS style sheet to your application.

Hope this will fix your issue.

VSM
  • 1,765
  • 8
  • 18
1

We have the same issue on https://www.flimmo.de and self hosting didn't solve the issue. But I found the reason: Content Blocker

I have Firefox Klar running. When I disable it the page renders correctly.

Firefox Focus/Klar can block Web fonts, which has to be deactivated in the Klar App Settings, see https://github.com/mozilla-mobile/focus-ios/issues/1889

0llie
  • 8,758
  • 2
  • 24
  • 13
  • For me, I use AdBlock Pro on my MacBook. There is a rule called "#6 Custom", whose description is: "Blocking filters for language specific websites and more.". After disabling this particular rule, I'm able to see the icons load again! Manually disabling the "Block custom web fonts" option didn't seem to help in my case - but the issue was my Content Blocker. – Pablo Alexis Domínguez Grau Feb 13 '23 at 03:59
0

I had the same problem. For me it was being loaded in safari, the browser was just not repainting / recalculating the styles after loading this font (in my case it was being loaded from Googles CDN).

What I did was, instead of loading the font in my index.html with the rest of the bundle I added an @import in my App.vue CSS. If you are not using Vue I guess you can add a CSS file that imports the font from the CDN instead of having it in the index.html.

Hope this will help somebody ✌✌

Jordi Enric
  • 116
  • 4