In Drupal 9 I have find out that the modernizr and touchevents javascript files are requested from the header instead of footer. This causes a render blocking issue while monitoring my site using GTMetrix .So, I've requested those javascript files from footer instead of header. After doing that the navigation buttons like slider next and previous buttons are not working. Either i need to make the buttons working after requesting the JS files from footer or I need another solution to solve the render-blocking issue.

Thanks in advance!

  • JS should have an onload hook to execute after code has been loaded. In Drupal the onload hook is Drupal.behaviors. If you have put your code into an onload handler, it won't break by moving the script to the footer.
    – Jaypan
    Mar 13 at 14:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.