diff --git a/src/ThemeBundle/Resources/views/Layout/base-layout.html.twig b/src/ThemeBundle/Resources/views/Layout/base-layout.html.twig
index 7f2966176a..725c57a5f6 100644
--- a/src/ThemeBundle/Resources/views/Layout/base-layout.html.twig
+++ b/src/ThemeBundle/Resources/views/Layout/base-layout.html.twig
@@ -60,6 +60,7 @@
+ {# chamilo.js is generated using the file webpack.config.js and using yarn read /assets/README.md for more info #}
@@ -78,6 +79,12 @@
{##}
{% block chamilo_header_js %}
+ {# Loading legacy js using the $htmlHeadXtra array #}
+ {% autoescape false %}
+ {% for js in legacy_javascript %}
+ {{ js }}
+ {% endfor %}
+ {% endautoescape %}
{% include '@ChamiloTheme/Layout/header.js.twig' %}
{% endblock %}