diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
index 9b34f151cd1f50b827ed0bc314bd1639395aa8db..e3d7a82466992b9e49e32cefdc69cb5c223bad3b 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
@@ -687,19 +687,30 @@ class ContentObjectRenderer implements LoggerAwareInterface
      */
     public function cObjGet($setup, $addKey = '')
     {
-        if (!is_array($setup)) {
-            return '';
+        return implode('', $this->cObjGetSeparated($setup, $addKey));
+    }
+
+    /**
+     * Rendering of a "numerical array" of cObjects from TypoScript
+     * Will call ->cObjGetSingle() for each cObject found.
+     *
+     * @return list<string>
+     */
+    public function cObjGetSeparated(?array $setup, string $addKey = ''): array
+    {
+        if (!is_array($setup) || $setup === []) {
+            return [];
         }
         $sKeyArray = ArrayUtility::filterAndSortByNumericKeys($setup);
-        $content = '';
+        $contentObjects = [];
         foreach ($sKeyArray as $theKey) {
             $theValue = $setup[$theKey];
             if ((int)$theKey && !str_contains($theKey, '.')) {
                 $conf = $setup[$theKey . '.'] ?? [];
-                $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
+                $contentObjects[] = $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
             }
         }
-        return $content;
+        return $contentObjects;
     }
 
     /**
diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
index f16cefd9ae8c12bb1af65f1d01406b7cabe26d6c..459d844149f1f50320f5cf878bdf6b509e77c86f 100644
--- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php
+++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
@@ -716,9 +716,21 @@ class RequestHandler implements RequestHandlerInterface
         );
 
         // Javascript inline code
-        $inlineJS = $controller->cObj->cObjGet($controller->pSetup['jsInline.'] ?? null, 'jsInline.');
+        $inlineJS = implode(
+            LF,
+            $controller->cObj->cObjGetSeparated(
+                $controller->pSetup['jsInline.'] ?? null,
+                'jsInline.'
+            )
+        );
         // Javascript inline code for Footer
-        $inlineFooterJs = $controller->cObj->cObjGet($controller->pSetup['jsFooterInline.'] ?? null, 'jsFooterInline.');
+        $inlineFooterJs = implode(
+            LF,
+            $controller->cObj->cObjGetSeparated(
+                $controller->pSetup['jsFooterInline.'] ?? null,
+                'jsFooterInline.'
+            )
+        );
         $compressJs = (bool)($controller->config['config']['compressJs'] ?? false);
 
         // Needs to be called after call cObjGet() calls in order to get all headerData and footerData and replacements
diff --git a/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php b/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php
index 80f9889e562be211982a9c4914b7d9f922cb2307..d1fb89db604455e2a0f75a488d07bab566ff5aea 100644
--- a/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php
+++ b/typo3/sysext/frontend/Tests/Unit/Http/RequestHandlerTest.php
@@ -241,6 +241,7 @@ class RequestHandlerTest extends UnitTestCase
         $siteLanguage = $this->createSiteWithLanguage()->getLanguageById(3);
         $cObj = $this->prophesize(ContentObjectRenderer::class);
         $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
+        $cObj->cObjGetSeparated(Argument::cetera())->willReturn([]);
         $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
         $tmpl = $this->prophesize(TemplateService::class);
         $frontendControllerProphecy = $this->prophesize(TypoScriptFrontendController::class);
@@ -284,6 +285,7 @@ class RequestHandlerTest extends UnitTestCase
         $siteLanguage = $this->createSiteWithLanguage()->getLanguageById(3);
         $cObj = $this->prophesize(ContentObjectRenderer::class);
         $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
+        $cObj->cObjGetSeparated(Argument::cetera())->willReturn([]);
         $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
         $tmpl = $this->prophesize(TemplateService::class);
         $frontendControllerProphecy = $this->prophesize(TypoScriptFrontendController::class);
@@ -332,6 +334,7 @@ class RequestHandlerTest extends UnitTestCase
         $siteLanguage = $this->createSiteWithLanguage()->getLanguageById(3);
         $cObj = $this->prophesize(ContentObjectRenderer::class);
         $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
+        $cObj->cObjGetSeparated(Argument::cetera())->willReturn([]);
         $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
         $tmpl = $this->prophesize(TemplateService::class);
         $frontendControllerProphecy = $this->prophesize(TypoScriptFrontendController::class);
@@ -435,6 +438,7 @@ class RequestHandlerTest extends UnitTestCase
         $siteLanguage = $this->createSiteWithLanguage()->getLanguageById(3);
         $cObj = $this->prophesize(ContentObjectRenderer::class);
         $cObj->cObjGet(Argument::cetera())->shouldBeCalled();
+        $cObj->cObjGetSeparated(Argument::cetera())->willReturn([]);
         $cObj->stdWrap(Argument::cetera())->willReturn($stdWrapResult);
         $tmpl = $this->prophesize(TemplateService::class);
         $frontendControllerProphecy = $this->prophesize(TypoScriptFrontendController::class);