Render blocking Javascript at end of body tag - Firefox renders some visual content, Chrome does not

前端 未结 2 453
伪装坚强ぢ
伪装坚强ぢ 2021-01-24 22:16

I am just experimenting with a few performance related optimizations.

As per my understanding, any inline script is render blocking and the browser executes

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-24 22:34

    alert isn't a good tool to use to check for rendering behavior. Browsers are increasingly making alert and its cousins less blocking (not just Firefox, Chrome's doing it too, but despite a lot of overlap they may be doing different things; you can read about Chrome's approach here).

    So apparently, Firefox is allowing the rendering to go forward, but Chrome isn't in this specific case.

    To check rendering behavior, you need to use something blocking that isn't an archaic holdover from the 1990's. :-) One way I've used (though not lately) is to load a script that takes a long time to load. (You can do that by having a local server that sends the script using server-side code that introduces an artificial delay in the process.)

提交回复
热议问题