( Need Help ) Defer parsing of JavaScript - Leverage browser caching - Avoid bad requests

[email protected]

Jr. VIP
Jr. VIP
Joined
Aug 31, 2018
Messages
2,309
Reaction score
1,599
When I checked one of my sites in gt metrics I got terrible scores in
Defer parsing of JavaScript- Leverage browser caching - Avoid bad requests

Leverage browser caching for the following cacheable resources: (expiration not specified)

Avoid bad requests: The following requests are returning 404/410 responses. Either fix the broken links or remove the references to the non-existent resources.

Avoid bad requests: 1007.6KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.

This is not a WordPress site. Can some kind-hearted expert please let me know the way to fix this or a simple guide to go through.

Thanks a lot in advance
 

[email protected]

Jr. VIP
Jr. VIP
Joined
Aug 31, 2018
Messages
2,309
Reaction score
1,599
Found Solution for this one and fixed. just in case if someone in the same kind of situation as me, edit the below code into your htaccess with custom adjustments.
Still looking for the help for other two issues

Leverage browser caching:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
 

Veil123

Jr. VIP
Jr. VIP
Joined
Jun 13, 2012
Messages
1,586
Reaction score
2,687
Website
codevix.com
2. The bad requests problem is usually happening due to invalid (removed) links or resources that are being called from your html or CSS. Check the Inspect Elements > Network tab for more info.
3. You need to have a better structure for the javascript that is being loaded on your website. Do you have an iframe youtube video somewhere on the page?
 
Top