{"componentChunkName":"component---src-templates-post-js","path":"/blog/2019/11/18/network-info-api/","result":{"data":{"post":{"html":"<p>This year has been full of articles around how the web is bloated with static assets and how this has impacted users to face a poor user experience when using not so good networks around the world. There are resources like <a href=\"https://web.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">web.dev</a> who are actively publishing content on how to make a better future for the web.</p>\n<!--more-->\n<h2 id=\"background\" style=\"position:relative;\"><a href=\"#background\" aria-label=\"background permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Background</h2>\n<p>I’ve also published a few 😁 on how to improve web performance which you should totally check them out 👇🏼:</p>\n<ul>\n<li><a href=\"https://yashints.dev/blog/2018/09/29/web-perf-1\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">HTML and CSS</a></li>\n<li><a href=\"https://yashints.dev/blog/2018/10/06/web-perf-2\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Preload/Prefetch to boost load time</a></li>\n<li><a href=\"https://yashints.dev/blog/2018/10/12/web-perf-3\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">JavaScript performance improvements</a></li>\n<li><a href=\"https://yashints.dev/blog/2018/11/12/web-perf-4\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Image optimisations</a></li>\n<li><a href=\"https://yashints.dev/blog/2018/11/23/web-perf-5\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Web font optimisations</a></li>\n</ul>\n<p>And other <a href=\"https://yashints.dev/blog/2019/05/11/offscreen-canvas\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">tips and tricks like how to use the <code class=\"language-text\">OffscreenCanvas</code> to render your graphics off the main thread</a>.</p>\n<p>This article is around the same topic, but we’re gonna see how to inspect and react to connection aspects of a visiting user to deliver a better experience to them.</p>\n<p>There are some implementations of this in the wild such as BBC News showing a warning to users about being charged by operators if they’re on a cellular network:</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 277px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/4ef71c4967a8a4629c2596863b261456/2a985/web_bbc_cellular.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 68.51851851851852%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAIAAACgpqunAAAACXBIWXMAAAsTAAALEwEAmpwYAAABvklEQVR42qWSR44iURBE61Ys8AhfwOBNYwSCDU5YAd14boMACVYIu2LLHWCOgNjPvKoaGNRoVhOL1P+RGZFZ+Uv49R8QTqdTs9n8euBTRrvdJirXJ6mcQa/Xa7Va5/NZmE6narU6Ho97PB632x0IBPx+fzKZJHq93mAwCA8ZCoWInH/IUKlU6/VamM/noihOJhMs8aNnt9sdjUbD4RCm0+kwFz0HgwE8WfhSqWQwGPb7vTCbzVwuF3X9fr9er5fLZWKhUECGV7VardVqxWKx0WhwxqhSqTAU4t1u90cMS1rxpghlPp/ngBFirspEDJjJZOx2u8lk2m63kpixmeq5KgRMQWnngfF4nMvl0ul0NpulLc2MRqMkXiwWZrM5kUikUqkPGZFIhAgTi8VYJDz7Y1sWi8VqtTqdTvb6V6zVah0Oh5IDNpvN+gKFZ1RRBmKiXq+XxKvVCmU4HA7+A+8pGCyOx6MkxlV5xm/wy+C1v/EU0+9wOEjvrNFocLI/wJA+n4/9szxei1fgI/mWZwHFOp1us9kIy+WSr1I6PIEY+4iMaDTK9TVLMQ2kn+R2u10ul59vuF6vlwfes5D3+/03EG2QmWe4x4QAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"BBC News warning users they might get charged by they network operator\"\n        title=\"\"\n        src=\"/static/4ef71c4967a8a4629c2596863b261456/2a985/web_bbc_cellular.png\"\n        srcset=\"/static/4ef71c4967a8a4629c2596863b261456/01bf6/web_bbc_cellular.png 270w,\n/static/4ef71c4967a8a4629c2596863b261456/2a985/web_bbc_cellular.png 277w\"\n        sizes=\"(max-width: 277px) 100vw, 277px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>Or GMail showing a ‘load basic HTML (for slow connections)’ message:</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 371px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/01f2130c77e4bb7385cf3a975b80829b/d4635/web_gmail.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 25.925925925925924%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAAsTAAALEwEAmpwYAAABK0lEQVR42o2PQU7CYBCFe0YMC7yBLPEAeAB0CUs3LF2IC0OBVJYmjShEhRZaQKEt1BaFtgSwfv6tF3CSlzdvZvIyTwrCkMMh4nsfYM9NJuaA4cig2+3Rbt+hKAqNhkytdkO1WqVer6ezVquFLMuoqkoURSlC4SWFQUBP81DubSqXTS4qt1xdNymXyxSLZxQKp+Ryx2QyRwIZstlsyvmTvNgVKJ2X8DwP3/cJhJe03Ubokw3qy5pnc8freM/XZgc/Mf+pOI5TowTJl5JjW+iaxvvUSOMawwGmYaKJmaY5InpA50Gk6AnuhDw9+hijEf2+jq7rDLRhepvo5XKJ5HkfzGYW87mT8kzwcuHi2DaW9Ylphn8Yh2IfMX1b47outu2wWCxwnKS3U71arfgF3D9c1miK0ckAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"GMail showing load basic HTML view for slow connections\"\n        title=\"\"\n        src=\"/static/01f2130c77e4bb7385cf3a975b80829b/d4635/web_gmail.png\"\n        srcset=\"/static/01f2130c77e4bb7385cf3a975b80829b/01bf6/web_gmail.png 270w,\n/static/01f2130c77e4bb7385cf3a975b80829b/d4635/web_gmail.png 371w\"\n        sizes=\"(max-width: 371px) 100vw, 371px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<h2 id=\"network-information-api\" style=\"position:relative;\"><a href=\"#network-information-api\" aria-label=\"network information api permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Network Information API</h2>\n<p>So far we have tried to improve the user experience by following one of the aforementioned techniques for everybody regardless of what network they are using. But what if we had a mean to inspect and detect their network connection properties and speed change while they’re browsing our applications.</p>\n<p>That’s when the <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Network Information API</a> comes into play. This API provides information about the connection such as type (i.e. WiFi or Cellular, you could see the full list 👇🏼):</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"37039384416566160000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied to clipboard ✅\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`enum ConnectionType {\r\n  &quot;bluetooth&quot;,\r\n  &quot;cellular&quot;,\r\n  &quot;ethernet&quot;,\r\n  &quot;mixed&quot;,\r\n  &quot;none&quot;,\r\n  &quot;other&quot;,\r\n  &quot;unknown&quot;,\r\n  &quot;wifi&quot;,\r\n  &quot;wimax&quot;\r\n};`, `37039384416566160000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                Copy<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"ts\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-ts line-numbers\"><code class=\"language-ts\"><span class=\"token keyword\">enum</span> ConnectionType <span class=\"token punctuation\">{</span>\r\n  <span class=\"token string\">\"bluetooth\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"cellular\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"ethernet\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"mixed\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"none\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"other\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"unknown\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"wifi\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"wimax\"</span>\r\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Here is how to access this information:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"50274052302378690000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied to clipboard ✅\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`let connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;`, `50274052302378690000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                Copy<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-js line-numbers\"><code class=\"language-js\"><span class=\"token keyword\">let</span> connection <span class=\"token operator\">=</span> navigator<span class=\"token punctuation\">.</span>connection <span class=\"token operator\">||</span> navigator<span class=\"token punctuation\">.</span>mozConnection <span class=\"token operator\">||</span> navigator<span class=\"token punctuation\">.</span>webkitConnection<span class=\"token punctuation\">;</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span></span></pre></div>\n<p>Here is how the object you’ll get looks like:</p>\n<p><img src=\"/e4821b2148d757f6c7e5992e16e934f8/NetworkInformationObject.jpg\" alt=\"Network Information object\"></p>\n<h2 id=\"networkinformation-object\" style=\"position:relative;\"><a href=\"#networkinformation-object\" aria-label=\"networkinformation object permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>NetworkInformation object</h2>\n<p>So let’s see what are these properties one by one:</p>\n<h3 id=\"code-classlanguage-texteffectivetypecode\" style=\"position:relative;\"><a href=\"#code-classlanguage-texteffectivetypecode\" aria-label=\"code classlanguage texteffectivetypecode permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">effectiveType</code></h3>\n<p>This property is showing the effective connection type. This is a bit different to the connection type we mentioned earlier. It changes based on a combination of recently observed <code class=\"language-text\">ttl</code> and <code class=\"language-text\">downlink</code>.</p>\n<p>The possible values for <code class=\"language-text\">effectiveType</code> is an enum with these values:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"84146655027063030000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied to clipboard ✅\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`enum EffectiveConnectionType {\r\n  &quot;2g&quot;,\r\n  &quot;3g&quot;,\r\n  &quot;4g&quot;,\r\n  &quot;slow-2g&quot;\r\n};`, `84146655027063030000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                Copy<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"ts\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-ts line-numbers\"><code class=\"language-ts\"><span class=\"token keyword\">enum</span> EffectiveConnectionType <span class=\"token punctuation\">{</span>\r\n  <span class=\"token string\">\"2g\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"3g\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"4g\"</span><span class=\"token punctuation\">,</span>\r\n  <span class=\"token string\">\"slow-2g\"</span>\r\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>In reality if this property has <code class=\"language-text\">slow-2g</code> it means you should avoid sending images, videos, etc. It’s suitable for sending text only content. If the value is <code class=\"language-text\">2g</code> it indicates that you could potentially send small low res images to user.</p>\n<p><code class=\"language-text\">3g</code> means you can send larger assets such as high res images, SD videos, and audio. At last <code class=\"language-text\">4g</code> means the network is suited for HD video, streaming and other data heavy resources.</p>\n<h3 id=\"code-classlanguage-textdownlinkcode\" style=\"position:relative;\"><a href=\"#code-classlanguage-textdownlinkcode\" aria-label=\"code classlanguage textdownlinkcode permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">downlink</code></h3>\n<p>This shows the download speed of the connection. The unit uses is megabits per second.</p>\n<h3 id=\"code-classlanguage-textonchangecode\" style=\"position:relative;\"><a href=\"#code-classlanguage-textonchangecode\" aria-label=\"code classlanguage textonchangecode permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">onchange</code></h3>\n<p>This property allows you to set an event handler for the <code class=\"language-text\">change</code> event on <code class=\"language-text\">NetworkInformation</code> object.</p>\n<h3 id=\"code-classlanguage-textrttcode\" style=\"position:relative;\"><a href=\"#code-classlanguage-textrttcode\" aria-label=\"code classlanguage textrttcode permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">rtt</code></h3>\n<p>This attribute represents the round trip time estimate in milliseconds nearest to 25 milliseconds and is based on application layer RTT measurements.</p>\n<h3 id=\"code-classlanguage-textsavedatacode\" style=\"position:relative;\"><a href=\"#code-classlanguage-textsavedatacode\" aria-label=\"code classlanguage textsavedatacode permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"language-text\">saveData</code></h3>\n<p>This property when getting returns <code class=\"language-text\">true</code> if the user has requested to reduce data usage mode from the user agent. Otherwise it returns <code class=\"language-text\">false</code>.</p>\n<p>If you are wondering what happened to <code class=\"language-text\">type</code> property, it is not currently supported by the browsers and no one knows if that will be because the spec is in a draft mode and might get changed. You can find more information on the browser support page at the end of this article.</p>\n<h2 id=\"use-cases\" style=\"position:relative;\"><a href=\"#use-cases\" aria-label=\"use cases permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Use cases</h2>\n<h3 id=\"prevent-from-preloading-videos\" style=\"position:relative;\"><a href=\"#prevent-from-preloading-videos\" aria-label=\"prevent from preloading videos permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Prevent from preloading videos</h3>\n<p>Now that we know what to expect from this API, lets see what we can do with it. Imagine we’re preloading videos in our page. We can hook up to the <code class=\"language-text\">change</code> event and stop preloading if the user is on a slower network:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"94610031224563920000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied to clipboard ✅\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`let preloadVideo = true;\r\nconst slowConnections = ['2g', '2g-slow'];\r\nvar connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;\r\nlet type = connection.effectiveType;\r\n\r\nfunction updateVideoPreloadingStrategy() {\r\n  console.log(&quot;Connection type changed from &quot; + type + &quot; to &quot; + connection.effectiveType);\r\n  type = connection.effectiveType;\r\n\r\n  if (slowConnections.containes(type)) {\r\n    preloadVideo = false;\r\n  }\r\n}\r\n\r\nconnection.addEventListener('change', updateVideoPreloadingStrategy);`, `94610031224563920000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                Copy<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-js line-numbers\"><code class=\"language-js\"><span class=\"token keyword\">let</span> preloadVideo <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">;</span>\r\n<span class=\"token keyword\">const</span> slowConnections <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token string\">'2g'</span><span class=\"token punctuation\">,</span> <span class=\"token string\">'2g-slow'</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\r\n<span class=\"token keyword\">var</span> connection <span class=\"token operator\">=</span> navigator<span class=\"token punctuation\">.</span>connection <span class=\"token operator\">||</span> navigator<span class=\"token punctuation\">.</span>mozConnection <span class=\"token operator\">||</span> navigator<span class=\"token punctuation\">.</span>webkitConnection<span class=\"token punctuation\">;</span>\r\n<span class=\"token keyword\">let</span> type <span class=\"token operator\">=</span> connection<span class=\"token punctuation\">.</span>effectiveType<span class=\"token punctuation\">;</span>\r\n\r\n<span class=\"token keyword\">function</span> <span class=\"token function\">updateVideoPreloadingStrategy</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\r\n  console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Connection type changed from \"</span> <span class=\"token operator\">+</span> type <span class=\"token operator\">+</span> <span class=\"token string\">\" to \"</span> <span class=\"token operator\">+</span> connection<span class=\"token punctuation\">.</span>effectiveType<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\r\n  type <span class=\"token operator\">=</span> connection<span class=\"token punctuation\">.</span>effectiveType<span class=\"token punctuation\">;</span>\r\n\r\n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>slowConnections<span class=\"token punctuation\">.</span><span class=\"token function\">containes</span><span class=\"token punctuation\">(</span>type<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\r\n    preloadVideo <span class=\"token operator\">=</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">;</span>\r\n  <span class=\"token punctuation\">}</span>\r\n<span class=\"token punctuation\">}</span>\r\n\r\nconnection<span class=\"token punctuation\">.</span><span class=\"token function\">addEventListener</span><span class=\"token punctuation\">(</span><span class=\"token string\">'change'</span><span class=\"token punctuation\">,</span> updateVideoPreloadingStrategy<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h3 id=\"load-low-res-images\" style=\"position:relative;\"><a href=\"#load-low-res-images\" aria-label=\"load low res images permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Load low res images</h3>\n<p>You could potentially set a class to your elements and based on that load a different image:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"87886306906286110000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied to clipboard ✅\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`function updateImageLoadingStrategy() {\r\n  console.log(&quot;Connection type changed from &quot; + type + &quot; to &quot; + connection.effectiveType);\r\n  type = connection.effectiveType;\r\n\r\n  const myEl = document.querySelector('#id');\r\n\r\n  if (slowConnections.containes(type)) {\r\n    myEl.classList.add(&quot;low-res&quot;);\r\n  } else {\r\n    myEl.classList.remove(&quot;low-res&quot;);\r\n  }\r\n}`, `87886306906286110000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                Copy<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-js line-numbers\"><code class=\"language-js\"><span class=\"token keyword\">function</span> <span class=\"token function\">updateImageLoadingStrategy</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\r\n  console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Connection type changed from \"</span> <span class=\"token operator\">+</span> type <span class=\"token operator\">+</span> <span class=\"token string\">\" to \"</span> <span class=\"token operator\">+</span> connection<span class=\"token punctuation\">.</span>effectiveType<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\r\n  type <span class=\"token operator\">=</span> connection<span class=\"token punctuation\">.</span>effectiveType<span class=\"token punctuation\">;</span>\r\n\r\n  <span class=\"token keyword\">const</span> myEl <span class=\"token operator\">=</span> document<span class=\"token punctuation\">.</span><span class=\"token function\">querySelector</span><span class=\"token punctuation\">(</span><span class=\"token string\">'#id'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\r\n\r\n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>slowConnections<span class=\"token punctuation\">.</span><span class=\"token function\">containes</span><span class=\"token punctuation\">(</span>type<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\r\n    myEl<span class=\"token punctuation\">.</span>classList<span class=\"token punctuation\">.</span><span class=\"token function\">add</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"low-res\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\r\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">{</span>\r\n    myEl<span class=\"token punctuation\">.</span>classList<span class=\"token punctuation\">.</span><span class=\"token function\">remove</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"low-res\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\r\n  <span class=\"token punctuation\">}</span>\r\n<span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>And:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"83043346104712200000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied to clipboard ✅\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`#id {\r\n  background: url(high-res.jpg) 0 0 no-repeat;\r\n}\r\n\r\n#id.low-res {\r\n  background: url(low-res.jpg) 0 0 no-repeat;\r\n}`, `83043346104712200000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                Copy<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"css\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-css line-numbers\"><code class=\"language-css\"><span class=\"token selector\">#id</span> <span class=\"token punctuation\">{</span>\r\n  <span class=\"token property\">background</span><span class=\"token punctuation\">:</span> <span class=\"token url\"><span class=\"token function\">url</span><span class=\"token punctuation\">(</span>high-res.jpg<span class=\"token punctuation\">)</span></span> 0 0 no-repeat<span class=\"token punctuation\">;</span>\r\n<span class=\"token punctuation\">}</span>\r\n\r\n<span class=\"token selector\">#id.low-res</span> <span class=\"token punctuation\">{</span>\r\n  <span class=\"token property\">background</span><span class=\"token punctuation\">:</span> <span class=\"token url\"><span class=\"token function\">url</span><span class=\"token punctuation\">(</span>low-res.jpg<span class=\"token punctuation\">)</span></span> 0 0 no-repeat<span class=\"token punctuation\">;</span>\r\n<span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h2 id=\"summary\" style=\"position:relative;\"><a href=\"#summary\" aria-label=\"summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Summary</h2>\n<p>We saw how useful can <strong>Network Information API</strong> be in most of our use cases where we want to address performance issue or even deliver a better user experience. Some other applicable use cases are:</p>\n<ul>\n<li>Not load high res images</li>\n<li>Prevent loading web fonts</li>\n<li>HTTP calls are changed to fetch less data using summary instead of full page load</li>\n<li>Timeout values for HTTP calls are increased</li>\n<li>Showing warning and other informative messages to users to let them know they might get charged</li>\n</ul>\n<blockquote>\n<p>💡 This API is in a <strong>draft</strong> state and might change in the future. But it doesn’t hurt to be proactive and update the implementation later rather than waiting for the full spec.</p>\n</blockquote>\n<p>You can find more about this on <a href=\"https://wicg.github.io/netinfo/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">the specification</a>.</p>\n<h2 id=\"browser-support\" style=\"position:relative;\"><a href=\"#browser-support\" aria-label=\"browser support permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Browser support</h2>\n<p>So Network Information API is good and everything, but how about the browser support. Currently it is supported in Chrome and MS Edge only.</p>\n<p>You can see <a href=\"https://caniuse.com/#feat=netinfo\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">the full list here</a>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 1080px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/3132da2caceacc942c5104290a181b4a/e4894/caniusenetinfo.jpg\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 26.296296296296294%; position: relative; bottom: 0; left: 0; background-image: url('data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAFABQDASIAAhEBAxEB/8QAFwABAAMAAAAAAAAAAAAAAAAAAAECBf/EABYBAQEBAAAAAAAAAAAAAAAAAAIAAf/aAAwDAQACEAMQAAAB1LAUiz//xAAXEAADAQAAAAAAAAAAAAAAAAAAARIC/9oACAEBAAEFAp0SyWf/xAAUEQEAAAAAAAAAAAAAAAAAAAAQ/9oACAEDAQE/AT//xAAUEQEAAAAAAAAAAAAAAAAAAAAQ/9oACAECAQE/AT//xAAXEAEBAQEAAAAAAAAAAAAAAAAAMjGh/9oACAEBAAY/Ar4pr//EABoQAAICAwAAAAAAAAAAAAAAAAABESExgeH/2gAIAQEAAT8huBZ3LQkcn//aAAwDAQACAAMAAAAQg/8A/8QAFREBAQAAAAAAAAAAAAAAAAAAEQD/2gAIAQMBAT8QWb//xAAVEQEBAAAAAAAAAAAAAAAAAAABEP/aAAgBAgEBPxACf//EABkQAQEBAQEBAAAAAAAAAAAAAAERACFR4f/aAAgBAQABPxB5FTwBjNKSJM1blre/e//Z'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Browser support\"\n        title=\"\"\n        src=\"/static/3132da2caceacc942c5104290a181b4a/47311/caniusenetinfo.jpg\"\n        srcset=\"/static/3132da2caceacc942c5104290a181b4a/6f81f/caniusenetinfo.jpg 270w,\n/static/3132da2caceacc942c5104290a181b4a/09d21/caniusenetinfo.jpg 540w,\n/static/3132da2caceacc942c5104290a181b4a/47311/caniusenetinfo.jpg 1080w,\n/static/3132da2caceacc942c5104290a181b4a/e4894/caniusenetinfo.jpg 1513w\"\n        sizes=\"(max-width: 1080px) 100vw, 1080px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>Now go have fun with this API and save your users some money 😁.</p>","timeToRead":4,"frontmatter":{"unformattedDate":"2019-11-18T00:00:00.000Z","date":"November 18, 2019","title":"Network Information API, another step towards a better web 😍","subtitle":null,"id":null,"author":"Yaser Adel Mehraban","gravatar":null,"canonical_url":null,"tags":["showdev","webdev","networkinformation","progressiveenhancements"],"thumbnail":null,"cover":{"childImageSharp":{"gatsbyImageData":{"layout":"constrained","placeholder":{"fallback":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAIAAAA7N+mxAAAACXBIWXMAAAsTAAALEwEAmpwYAAACAElEQVR42hWO2XLaMBSG/dadvkKvO9NO36BXbWagS5qNLNhgCQgh2HjB8gpeJHmRFzkQKma++W/O959zpKVLtD3TY2amjYNbn7Y+OeOSFpEO4TYqeFR0US7g+4KHOXdxE4ppUkowLCx6eN1VM5S+BLmxK+1YUG2TytgVdtZqIRW2gxs7LQNcW3HhkS5rTz5ppCefLsmbYkYXI/VyuhqOwOBOubiWB7eTH5cPfx/h79H013h2NRzdXFxNTP9GWSydOGlPKK0lOchB0s5TbtCDW74DM7yF2v1cV9bu5NW5BWvV8G4Whr42ItdHzSlkR1S8GaTXYlEOcxg3KsqnNpl75SbpUHEM2FFIcfsetye3Ovrs6FRHqzhYmG8pNzHXcb/aVZJsp3BLVZMAJwduCVA5Q+XSrzZJa2VcYKRcz/iGnNFwr2Fu5OLN/mXHJFmP5w6d2xg6hTg+3iRPejzZ5qrHVLcCLgMeA2ENkg7iHma9GnVjq1ulolxJik2nT/Li8udsS++W3mD8OpDX9/oe+jXwGQjYOc9UIGyeaTd85B8/HL7f989ZKQFUDK/lL5+/KlYqm8nEwVMvH9sZ8CoY1DBg0GcwrGEkdtWLtPn3wj996/88d6pPpcdVMN6kIy1RrEwW2FhGVDETRd8pm72iiYzlLZYdojhECBMnAyGeIvKw3v8HIPsK1uaMRfEAAAAASUVORK5CYII="},"backgroundColor":"transparent","images":{"fallback":{"src":"/static/027bb1fcdcafa32c3e1f0d8eb251ff1c/a2195/socialpreview.png","srcSet":"/static/027bb1fcdcafa32c3e1f0d8eb251ff1c/cadb4/socialpreview.png 750w,\n/static/027bb1fcdcafa32c3e1f0d8eb251ff1c/a2195/socialpreview.png 800w","sizes":"(min-width: 800px) 800px, 100vw"},"sources":[{"srcSet":"/static/027bb1fcdcafa32c3e1f0d8eb251ff1c/11ba1/socialpreview.webp 750w,\n/static/027bb1fcdcafa32c3e1f0d8eb251ff1c/5f042/socialpreview.webp 800w","type":"image/webp","sizes":"(min-width: 800px) 800px, 100vw"}]},"width":800,"height":400}}},"img":null,"socialPreview":{"publicURL":"/static/027bb1fcdcafa32c3e1f0d8eb251ff1c/socialpreview.png"}}}},"pageContext":{"title":"Network Information API, another step towards a better web 😍","postPath":"/blog/2019/11/18/network-info-api","nextPost":"/blog/2019/11/18/vue-state-management","previousPost":"/blog/2019/11/10/vue-form-handling"}},"staticQueryHashes":[],"slicesMap":{}}