Add below code your WordPress theme functions.php manually not recommended
or try to user wp plugins scripts to footer (this not moves script in the mobile version of mobile.
speed booster pack move all the script but not allows to minify HTML.
Moving javascript footer why it’s important
Other than WordPress or small HTML pages you can place javascript after closing the </head> and before closing the </body> tag.
HTML loads first, so the user can see what they want. js Loads meanwhile.
Loading javascript asynchronously and defer parsing js
How to javascript Asynchronously?
just look at the Adsense ad code <script>
<script async src=”path to js file”></script>
How to defer load / parse Javascript?
Defer loading means wait until the HTML content then load javascript. quick possible solutions use async or defer. but it not works we need use on load function.
this is deep process only for developers. 90% of people ignore this.
Another thing is Optimize CSS Delivery
Minify CSS: Reducing the size by removing comments & Space This process applicable for JS and HTML too.
CSS Placement: why we have to place CSS in the header. Without CSS Plain HTML Loads it looks like ugly.
Inline CSS: if there is small CSS then try to inline the CSS instead loading from external file.
The best Plugin to cache all resources and serve quickly w3 total cache.
Check out my other thoughts Increase page speed score in google insights 95+, How to improve page speed
inline critical js small
it’s better online s just like critical css,
mostly responsive menu in mobile.
remove unused js
unload js files with asset cleanup.
Reduce the impact of third-party code
Third-party code blocked the main thread for 710 ms
<link rel=”dns-prefetch” href=”http://example.com”>
<link rel=”preconnect” href=”https://cdn.example.com”>
async and defer js
default behavior for script downloading and parsing is synchronous,
JavaScript marked async will always execute before JavaScript marked defer
Mediavine switched to lazy-loading ads and saw a 200% improvement in page load speed.
by google
service worker
a service worker to determine how often a piece of content should be fetched from the network,
Optimize HTML to Boost Web Performance
Clean up HTML
Don’t use inline styles / scripts.
minify html
compress
cache at browser no need
optimize page delivery
/** * Load Enqueued Scripts in the Footer * * Automatically move JavaScript code to page footer, speeding up page loading time. */ function footer_enqueue_scripts() { remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_enqueue_scripts', 1); add_action('wp_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5); add_action('wp_footer', 'wp_print_head_scripts', 5); } add_action('after_setup_theme', 'footer_enqueue_scripts');
Ask a Question:
You must be logged in to post a comment.