Defer parsing of JavaScript for mobile ?

Posted in: Newspaper
Post count: 312

Hi

I would like to know if Defer parsing of JavaScript for mobile is possible ?

https://developers.google.com/speed/pagespeed/insights/?hl=fr&url=https%3A%2F%2Flowtechnation.com%2F

Thank you

Kind regards

Post count: 35449

Hi,
This is a very good page speed on mobile and desktop.
If you are using the responsive version, then it should work, but for mobile theme this will be quite difficulty.
Here are some guides for how you can do this for a WordPress theme -> https://kinsta.com/blog/defer-parsing-of-javascript/ also if you are using the responsive version, then will be easier to use a plugin.
Thank you!

Post count: 312

Where do I have to insert this code in order to apply on mobile ?

// Preload Newspaper fonts for mobile theme

function dns_prefetch_mobile() {
	
	echo "<link href='https://MYDOMAIN.com/wp-content/plugins/td-composer/mobile/images/icons/mobile-theme.woff?9' rel='preload' as='font' type='font/woff' crossorigin>";
}

add_action( 'wp_head', 'dns_prefetch_mobile', 0 );
  • This reply was modified 5 years by gumball44.
  • This reply was modified 5 years by gumball44.
  • This reply was modified 5 years by gumball44.
Post count: 35449

Hi,
That code need to be set in functions.php, if you are using the mobile theme plugin, then the code need to be set in the file from this path -> wp-content/plugins/td-composer/mobile/functions.php
Hope this will help you!
Thank you!

Post count: 312

Thank you

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.