update session listener inject javascript before html tag instead of body

This commit is contained in:
Khoubza Younes
2020-12-10 05:13:54 +01:00
parent 25d30053dd
commit 75617dd2fd
+2 -2
View File
@@ -73,7 +73,7 @@ final class SessionListener implements EventSubscriberInterface
}
$content = $response->getContent();
//dd($content);
$html = '';
foreach ($rendereResponse['scripts'] as $script) {
@@ -94,7 +94,7 @@ if ("undefined" === typeof PHPFlasher) {
</script>
HTML;
$pos = strripos($content, '</body>');
$pos = strripos($content, '</html>');
$content = substr($content, 0, $pos).$html.substr($content, $pos);
$response->setContent($content);
}