Home / Tutorials / PrestaShop 1.7 Tutorials / How to Defer Parsing of JavaScript in prestashop

How to Defer Parsing of JavaScript in prestashop

How does JS affect the SiteSpeed ?

First of all, JavaScript(s) are one of the major culprits to make your website slow. The web browser comes across a script, it executes the script first before continue to load HTML that includes the content users are looking for. For a browser, executing a JavaScript is a heavier task (depending on the size of the script) and takes more time as compared to render the meaningful content (the first paint) of the webpage. Hence JavaScript affects the critical rendering path and slows down pagespeed of your website. Why not defer this heavier task of JS execution so that critical rendering path remain uninterrupted, right?

Follow these step to Defer Parsing of JavaScript in prestashop :

–Β  Add “async” into The code <script type=”text/javascript”> of file Root/themes/THEME_NAME/templates/_partials/javascript.tpl

– Turn on cache & compress css,js in Prestashop

– Checking it with GTMetrix website https://gtmetrix.com/reports/demo1.leotheme.com/401sex7aΒ 

 

About Leo Theme

Check Also

google_spped_mark

Google PageSpeed Insight for PrestaShop

1. Image – Use Lazyload Images : is a web-design technique that intentionally postpones the …

Leave a Reply

Your email address will not be published. Required fields are marked *