{"id":15610,"date":"2020-01-16T05:51:44","date_gmt":"2020-01-16T05:51:44","guid":{"rendered":"https:\/\/ampforwp.com\/tutorials\/?post_type=ht_kb&#038;p=15610"},"modified":"2020-02-13T12:13:50","modified_gmt":"2020-02-13T12:13:50","slug":"how-to-add-dns-prefetch-prefetch-preload-and-preconnect-urls-in-amp","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/how-to-add-dns-prefetch-prefetch-preload-and-preconnect-urls-in-amp\/","title":{"rendered":"How to add DNS Prefetch, Prefetch, preload and preconnect URLs in AMP"},"content":{"rendered":"\n<p>DNS Prefetch, Prefetch, Preload, and Preconnect is a new web standard that offers more control on how particular resources are fetched and it is another performance-enhancing technique. We can use it to tell the browser which assets the user might need in the future.<\/p>\n\n\n\n<h4>DNS prefetch<\/h4>\n\n\n\n<p>This notifies the client that there are assets we&#8217;ll need later from a specific URL so the browser can resolve the DNS as quickly as possible.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><link rel=\"dns-prefetch\" href=\"https:\/\/example.com\"><\/pre>\n\n\n\n<h4>Prefetch<\/h4>\n\n\n\n<p>If we&#8217;re certain that a specific resource will be required in the future, then we can ask the browser to request that item and store it in the cache for reference later.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><link rel=\"prefetch\" href=\"image.png\"><\/pre>\n\n\n\n<h4>Preload<\/h4>\n\n\n\n<p>A new spec called preload suggests that sometimes it&#8217;s best to always download an asset, regardless of whether the browser thinks that&#8217;s a good idea or not. Unlike prefetching assets, which can be ignored, preloading assets must be requested by the browser.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><link rel=\"preload\" href=\"image.png\"><\/pre>\n\n\n\n<h4>Preconnect<\/h4>\n\n\n\n<p>Preconnecting is another speed-optimization HTML tag, in which the browser sets up an early connection before an HTTP request is actually sent to the server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><link rel=\"preconnect\" href=\"https:\/\/example.com\"><\/pre>\n\n\n\n<p>You will find this option in the <strong>WordPress Dashboard<\/strong>&nbsp;-&gt; Navigate to&nbsp;<strong>AMP option panel<\/strong>&nbsp;-&gt;&nbsp;<strong>Settings<\/strong>&nbsp;-&gt;&nbsp;<strong>Advance Settings<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" loading=\"lazy\" width=\"395\" height=\"611\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/01\/9.png\" alt=\"\" class=\"wp-image-15611\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/01\/9.png 395w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/01\/9-194x300.png 194w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/01\/9-32x50.png 32w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/01\/9-39x60.png 39w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/01\/9-65x100.png 65w\" sizes=\"(max-width: 395px) 100vw, 395px\" \/><\/figure><\/div>\n\n\n\n<p>Scroll down a little to see this option<\/p>\n\n\n\n<p><strong>DNS Priority URL(s):<\/strong> In this option, four options will be displayed as per your requirement, you need to select the Option.  <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"851\" height=\"355\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56.png\" alt=\"\" class=\"wp-image-16348\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56.png 851w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56-300x125.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56-768x320.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56-50x21.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56-60x25.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-11-20-56-100x42.png 100w\" sizes=\"(max-width: 851px) 100vw, 851px\" \/><\/figure>\n\n\n\n<p><strong>For eg:\u00a0<\/strong>I\u2019ve selected the DNS-Prefetch and in this field, you need to enter DNS-Prefetch URL and if you want to add more URLs the click on the &#8220;<strong>Add More<\/strong>&#8221; button and then click on the&#8221;<strong>Save Changes<\/strong>&#8221; button which you can see in the below screenshot. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"848\" height=\"191\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2.png\" alt=\"\" class=\"wp-image-16381\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2.png 848w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2-300x68.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2-768x173.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2-50x11.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2-60x14.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/10-2-100x23.png 100w\" sizes=\"(max-width: 848px) 100vw, 848px\" \/><\/figure>\n\n\n\n<h4>The Output of the DNS Priority URL(s) in AMP<\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"169\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-1024x169.png\" alt=\"\" class=\"wp-image-16383\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-1024x169.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-300x49.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-768x127.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-50x8.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-60x10.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25-100x16.png 100w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/Desktop-2020-02-13-17-41-25.png 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>That\u2019s it for this tutorial!<\/strong><\/p>\n\n\n\n<p>We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.<\/p>\n\n\n\n<p><br><\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>DNS Prefetch, Prefetch, Preload, and Preconnect is a new web standard that offers more control on how particular resources are fetched and it is another performance-enhancing technique. We can use it to tell the browser which assets the user might need in the future. DNS prefetch This notifies the client&#8230;<\/p>\n","protected":false},"author":18,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[34],"ht-kb-tag":[],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/15610"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=15610"}],"version-history":[{"count":34,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/15610\/revisions"}],"predecessor-version":[{"id":16384,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/15610\/revisions\/16384"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=15610"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=15610"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=15610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}