Preload CSS file not supported on Firefox and Safari Mac

前端 未结 7 1816
日久生厌
日久生厌 2020-12-16 14:23

I added the attribute rel=\"preload\" to all css links like this :

   

        
7条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 15:11

    I found a possibly best solution is to load two files as below - browsers that support preload will use it as intended and those that don't (like Firefox) will only use the regular (2nd link). This solution doesn't require using the onload="this.rel='stylesheet'" since the style is used right after the preload:

    
    
    
    
    

    What I also discovered is a hacky alternative to the above could be including "rel" twice, like:

    
    

提交回复
热议问题