Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #58870, comment 4


Ignore:
Timestamp:
07/21/2023 11:47:12 AM (19 months ago)
Author:
sergiomdgomes
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58870, comment 4

    v1 v2  
    99To me, it seems that if this is an unimportant script that we don't mind executing late, it should live in the footer. This means it won't start fetching as early; even if it would do so at a lower priority, it could still start and compete for some bandwidth (in Chrome, low priority items will use less bandwidth but can still start before all higher priority items are finished, and thus delay them somewhat in constrained bandwidth situations).
    1010
    11 As such, it seems there's no obvious reason to include it in the head, but please correct me if I'm missing something.
     11As such, it seems there's no obvious reason to include it in the `<head>`, but please correct me if I'm missing something.
    1212
    1313Which leads us to the next orthogonal choice: blocking, `defer`, or `async`. Both blocking and `defer` will delay `DOMContentLoaded` until the script is fetched and executed. `async` will only delay `DOMContentLoaded` if the script is already in cache; i.e., the script may execute after `DOMContentLoaded` if it's not fetched in time. `async` will not preserve source order, but that doesn't sound like a concern here.