Issue Bug Closed

#98927JS async option of includeJS broke by file in includeJSFooter

Christian Toffolo 10/26/22, 11:18 updated 07/29/26, 13:24

Description

To reproduce, have a Typoscript like:

page {
  includeJS {
    headerJSfile = EXT:example/Resources/Public/JavaScript/headerJSfile.js
    headerJSfile.async = 1
  }
  includeJSFooter {
    footerJSfile = EXT:example/Resources/Public/JavaScript/footerJSfile.js
  }
}

Expected behavior it a HTML code like:
@<script src="/typo3temp/assets/compressed/merged-e942e6f0ca1ee79f54a389342a8850b9-78533bc4645ca634f7c62a6bbc42edef.js?1665838235" async="async"></script>
Instead
async=“async”@ is not present because of the file configured in includeJSFooter.

Reviews 2

History 45

  1. Christian Toffolo commented <span data-processor="relativetime" data-value="2022-10-26T11:30:05+00:00" > 10/26/22, 11:30 </span>

    addJsFooterFile() adds files to $this->jsFiles with 'section' => self::PART_FOOTER

    But then it seems to me that the ‘section’ value is not considered when deciding if to set async or not:
    https://github.com/TYPO3/typo3/blob/60a666737b24a7247a59ecc7fe7b13f95c75be20/typo3/sysext/core/Classes/Resource/ResourceCompressor.php#L153

    Also, $this->jsFooterFiles array seem to never be “filled”.

    So, why not use this array instead of mixing header and footer files in the same array $this->jsFiles ?

  2. Christian Kuhn commented <span data-processor="relativetime" data-value="2025-11-11T16:07:12+00:00" > 11/11/25, 16:07 </span>

    needs investigation if this is still an issue with #108055 being done.

  3. Benni Mack commented and changed status Under Review Closed <span data-processor="relativetime" data-value="2026-07-29T13:24:53+00:00" > 07/29/26, 13:24 </span>

    I double-checked, this is not needed anymore, and can be closed now – not an issue in v13+