Flash of unstyled content (FOUC) in Firefox only? Is FF slow renderer?

后端 未结 7 2010
[愿得一人]
[愿得一人] 2021-02-01 16:42

I\'m not seeing this issue in any other browser that I\'ve tested - IE, Chrome, Opera - but whenever I load a page from the server, I\'m seeing a flash of unstyled content befor

7条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 17:16

    I had the same problem with Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. showing in the console, and a visible flash of unstyled content upon page refresh, withouth (F5) or with clearing the cache (Ctrl + F5). Having the developer tools open does not made a difference either.

    What helped me was declaring a variable in a script just before the tag ended, so basically after all the tags.

    It's important to note, that an empty script (or with just a comment) or any random javaScript would not help, but declaring a variable worked.

    
      
      
    
      
    

    There was no need to rearrange links or not use imports within css or js files.

    Please note that the issue will no longer be visible (FOUC is visibly gone), but the console might still show the same warning.

提交回复
热议问题