{"id":11709,"date":"2022-04-14T07:19:05","date_gmt":"2022-04-14T07:19:05","guid":{"rendered":"https:\/\/nieuw.wpprovider.nl\/what-is-prefetch-preconnect-prerender\/"},"modified":"2024-08-13T20:28:58","modified_gmt":"2024-08-13T20:28:58","slug":"what-is-prefetch-preconnect-prerender","status":"publish","type":"post","link":"https:\/\/nieuw.wpprovider.nl\/en\/what-is-prefetch-preconnect-prerender\/","title":{"rendered":"What is Prefetch, Preconnect &amp; Prerender?"},"content":{"rendered":"\n<p>Fast loading (rendering) of a Web page is a must in today&#8217;s age.\nMost websites perform a basic checklist to make your website faster.\nThere are tools such as Page Speed Insights from Google, GTMetrix or Webpagetest that checks your website and suggests what can be improved so that the website displays faster.  <\/p>\n\n<p>When it comes to page speed, the main things most developers do are reduce (minify) files, gzip files and compress images.<\/p>\n\n<p>At a more advanced level, there are steps such as caching, using a CDN to distribute the resources (which is recommended if you have visitors from abroad), <a href=\"https:\/\/webpack.js.org\/guides\/code-splitting\/\" target=\"_blank\" rel=\"noreferrer noopener\">code splitting<\/a>, eliminating JavaScript blocks, etc.<\/p>\n\n<p>But there are other techniques that most people don&#8217;t talk about when they talk about making your Web page faster.\nThese performance enhancing techniques are commonly known as <a href=\"https:\/\/www.w3.org\/TR\/resource-hints\/\" target=\"_blank\" rel=\"noreferrer noopener\">Resource Hints<\/a> (prefetching techniques).\nIt&#8217;s a simple way of telling the browser &#8211; Hello browser, I will definitely need resources A, B and C at some point.\nSo prefetch that now, so we can quickly serve it later when requested.   <\/p>\n\n<p>The execution takes place in the <em>idle time<\/em> of the browser, which is the moment when the browser has already loaded the page and is doing nothing.\nThis means that when a visitor is reading your page or blog post, the browser loads another page in the background and calculates its display.\nThis way, the page is displayed faster as soon as the corresponding link is clicked.\nIn other words, pre-fetch and pre-render.   <\/p>\n\n<p>If you use Google Analytics, you can find out how visitors navigate through your website to make the best use of these techniques.<\/p>\n\n<p>The following Resource Hints can be used: dns-prefetch, prefetch, pre-connect and pre-render.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"4651\">DNS-Prefetch<\/h2>\n\n<p>A dns-prefetch tells the browser that we need a few sources of a particular URL so that the browser can start DNS handling as quickly as possible.<\/p>\n\n<pre class=\"wp-block-code\"><code>&lt;link rel=\u201ddns-prefetch\u201d href=\u201d\/\/een-website.nl\u201d&gt;<\/code><\/pre>\n\n<p>Suppose at some point within the website we are redirected to a-website.co.uk.\nWe can add the above line in the head of the website.\nAfter the browser parses the document, it starts DNS handling for a-website.co.uk.\nThis will make the further requests for one-website.co.uk a little faster.   <\/p>\n\n<p id=\"88b2\">Using DNS prefetch can save a lot of time with redirects and on mobile devices or locations where Internet speed is slower.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"2118\">Link Prefetch<\/h2>\n\n<p>A prefetch is used when we are sure that a particular resource will be used by the visitor at some point.\nDo not confuse dns-prefetch and prefetch, as both are used for different reasons.\nA common use case is to prefetch images that can be requested at a certain point.\nOnce the page is loaded, the browser begins fetching the image at, for example: example.com\/images\/logo.jpg   <\/p>\n\n<p id=\"ee5b\">A prefetch looks like this:<\/p>\n\n<pre class=\"wp-block-code\"><code>&lt;link rel=\u201dprefetch\u201d href=\u201dhttp:\/\/voorbeeld.nl\/afbeeldingen\/logo.jpg\"&gt;<\/code><\/pre>\n\n<p id=\"4165\">When this line occurs, the browser requests the image from the specified URL, downloads it and stores it in the browser cache.<\/p>\n\n<p id=\"954c\">Be careful not to prefetch too many or too large sources, your browser may then give you the following error message:<\/p>\n\n<pre class=\"wp-block-code\"><code>Failed to load resource: net::ERR_CACHE_WRITE_FAILURE<\/code><\/pre>\n\n<p>This means that the resource we were trying to prefetch is too large to write to the browser cache.\nOnly use prefetch if you are absolutely sure that the resource will be used at some point. <\/p>\n\n<h2 class=\"wp-block-heading\" id=\"34d0\">Pre-connect<\/h2>\n\n<p>For a browser, actions such as DNS handling (translating ip addresses to domain names), TCP (Transmission Control Protocol) handshake and TLS (Transport layer security) handling are relatively black tasks.<\/p>\n\n<p>Pre-connect is similar to a DNS prefetch, but also optionally performs the TCP handshake and TLS handoffs.\nThis saves user time by eliminating these actions. <\/p>\n\n<p>By including the following code in the main body of your website, you can connect a web page in advance.<\/p>\n\n<p><link rel=\"&#x201D;preconnect&#x201D;\" href=\"%80%\"\/><\/p>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" class=\"wp-image-1103\" src=\"https:\/\/nieuw.wpprovider.nl\/wp-content\/uploads\/Wat-is-Pre-connect.jpg.webp\" alt=\"\"\/>\n<figcaption><\/figcaption>\n<\/figure>\n\n<h2 class=\"wp-block-heading\">Pre-render<\/h2>\n\n<p>Pre-render is the supreme boss of all prefetching techniques and should be used carefully.\nPre-render instructs the browser to prefetch all sources of a given page with the code below: <\/p>\n\n<pre class=\"wp-block-code\"><code>&lt;link rel=\u201dprerender\u201d href=\u201dhttps:\/\/voorbeeld.nl\/bepaalde-pagina\"&gt;<\/code><\/pre>\n\n<p>In fact, at https:\/\/voorbeeld.nl\/bepaalde-pagina the page is invisibly loaded and saved by the browser.\nWhen the visitor navigates to this page then the browser can easily load the pre-rendered page, providing a better user experience. <\/p>\n\n<p>Here, it is important that you do not apply this unnecessarily because it is more likely to cause problems (unnecessary resources) than a faster page.<\/p>\n\n<h2 class=\"wp-block-heading\">How do I apply this?<\/h2>\n\n<p>Are you using our <a href=\"https:\/\/wpprovider.nl\/managed-wordpress-hosting\/\" target=\"_blank\" rel=\"noopener\">Managed WordPress package<\/a>?\nThen you don&#8217;t have to do this yourself, we take care of all the worries for you. <\/p>\n\n<h2 class=\"wp-block-heading\">Website remains slow?<\/h2>\n\n<p>It is not said that only these techniques make the website lightning fast, of course it is important that the basis (the web hosting) of your website is good.\nAre you not yet hosting with WP Provider? <a href=\"https:\/\/wpprovider.nl\/#vrijblijvend-contact\" target=\"_blank\" rel=\"noopener\">Get in touch<\/a> to discuss options. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fast loading (rendering) of a Web page is a must in today&#8217;s age. Most websites perform a basic checklist to make your website faster. There are tools such as Page Speed Insights from Google, GTMetrix or Webpagetest that checks your website and suggests what can be improved so that the website displays faster. When it [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-11709","post","type-post","status-publish","format-standard","hentry","category-geen-onderdeel-van-een-categorie"],"acf":[],"_links":{"self":[{"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/posts\/11709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/comments?post=11709"}],"version-history":[{"count":1,"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/posts\/11709\/revisions"}],"predecessor-version":[{"id":11710,"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/posts\/11709\/revisions\/11710"}],"wp:attachment":[{"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/media?parent=11709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/categories?post=11709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nieuw.wpprovider.nl\/en\/wp-json\/wp\/v2\/tags?post=11709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}