Speed Up web page using Prerender and prefetch

We could Load Web Page Faster using Prerender and prefetch support.

rel=prerender will load the next page in the Browser background.

It will work in background, while you are surfing the page you are on. The browser will download and keep the next page ready, but it will displayed when the link to Next page is Clicked.

Also, it will not affect the current page loading process.


‘prerender’
for Chrome and will load the top level resource like HTML.

‘prefetch’
for Firefox and will execute Javascript code.

rel=”prerender prefetch” will support all HTML5 browsers like IE 11, Opera 12.10
So, below code used to load the WordPress Posts quickly while use navigating into other posts and Home page.

<?php if (is_archive() && ($paged > 1) && ($paged < $wp_query->max_num_pages)) { ?>
<link rel="prefetch" href="<?php echo get_next_posts_page_link(); ?>">
<link rel="prerender" href="<?php echo get_next_posts_page_link(); ?>">
<?php } elseif (is_singular()) { ?>
<link rel="prefetch" href="<?php bloginfo('home'); ?>">
<link rel="prerender" href="<?php bloginfo('home'); ?>">
<?php } ?>

Leave a Reply

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