|
2 | 2 | title: Quicklink
|
3 | 3 | layout: layouts/base.njk
|
4 | 4 | description: Faster subsequent page-loads by prefetching in-viewport links during idle time.
|
5 |
| -sections: |
6 |
| - demo: |
7 |
| - title: "Demo" |
8 |
| - content: |
9 |
| - items: |
10 |
| - - |
11 |
| - description: A demo showing how to use Quicklink on a simple multi-page website. |
12 |
| - link: "* [Using Quicklink in a multi-page site](https://github.com/GoogleChromeLabs/quicklink/tree/master/demos/news)" |
13 |
| - - |
14 |
| - description: A demo showing how to use Quicklink with Workbox for offline caching and links in the visible viewport. |
15 |
| - link: "* [Using Quicklink with Service Workers (via Workbox)](https://github.com/GoogleChromeLabs/quicklink/tree/master/demos/news-workbox)" |
16 |
| - - description: A demo showing how to integrate Quicklink with create-react-app. |
17 |
| - link: "* [Using Quicklink in a React single-page app](https://github.com/GoogleChromeLabs/quicklink/tree/master/demos/spa)" |
18 | 5 | ---
|
19 | 6 | {% extends "layouts/normal-section-wrapper.njk" %}
|
20 | 7 | {% block section %}
|
21 |
| -{% sectionTitle sections.demo.title %} |
22 |
| -{% for item in sections.demo.content.items %} |
23 |
| - {{ item.description | markdown | safe }} |
24 |
| - {{ item.link | markdown | safe }} |
25 |
| -{% endfor %} |
| 8 | +{% markdownConvert %} |
| 9 | + |
| 10 | +## Demos |
| 11 | + |
| 12 | +This page contains some demo sites that use Quicklink to improve navigation, grouped by architecture: **Multi Page Apps** / **Single Page Apps**. |
| 13 | + |
| 14 | +If you like the library, and want to try them on your site, check out the **Installation** section of the [home page](/). |
| 15 | + |
| 16 | +#### Multi Page Apps |
| 17 | + |
| 18 | +In this demo you’ll compare an ecommerce site with and without Quicklink to see how navigation is improved thanks to the library. |
| 19 | + |
| 20 | +The following waterfall shows a typical navigation for a site without Quicklink (top) vs. the same site using the library (bottom): |
| 21 | + |
| 22 | +{% endmarkdownConvert %} |
| 23 | + |
| 24 | +<img loading="lazy" class="article-image" src="/assets/images/screenshots/wpt-visual-comparison.png" height="320px" width="615px"> |
| 25 | + |
| 26 | +{% markdownConvert %} |
| 27 | + |
| 28 | +To try the demo: |
| 29 | + |
| 30 | +1. Open the [unoptimized site](https://mini-ecomm.glitch.me/) in Chrome. |
| 31 | +1. Open **DevTools** and go to the **Network panel** to simulate a **Fast 3G** Connection. |
| 32 | +1. Pick **Galaxy S5** as a simulated device. |
| 33 | +1. Make sure **Disable cache** is not checked. |
| 34 | +1. Reload the page. |
| 35 | + |
| 36 | +{% endmarkdownConvert %} |
| 37 | + |
| 38 | +<img class="article-image" src="/assets/images/screenshots/devtools-unoptimized.png" height="130px" width="600px"> |
| 39 | + |
| 40 | +{% markdownConvert %} |
| 41 | + |
| 42 | +Now, measure performance on the same site, that uses Quicklink: |
| 43 | + |
| 44 | +1. Open the [optimized site](https://mini-ecomm-quicklink.glitch.me/) in Chrome. |
| 45 | +1. Open **DevTools** and go to the **Network panel** to simulate a **Fast 3G** Connection. |
| 46 | +1. Pick **Galaxy S5** as a simulated device. |
| 47 | +1. Make sure **Disable cache** is not checked. |
| 48 | +1. Reload the page. |
| 49 | + |
| 50 | +Prefetched links can be identified in the **Network** panel by having `quicklink` as the **Initiator** and **Lowest** as the **Priority**: |
| 51 | + |
| 52 | +{% endmarkdownConvert %} |
| 53 | + |
| 54 | +<img class="article-image" src="/assets/images/screenshots/devtools-optimized-1.png" height="130px" width="600px"> |
| 55 | + |
| 56 | +{% markdownConvert %} |
| 57 | + |
| 58 | +To measure the impact of `quicklink` on navigations: |
| 59 | + |
| 60 | +1. Clear the **Network** trace. |
| 61 | +1. Click on a list item. |
| 62 | +1. Take a look at the **Network** panel. |
| 63 | + |
| 64 | +{% endmarkdownConvert %} |
| 65 | + |
| 66 | +<img loading="lazy" class="article-image" src="/assets/images/screenshots/devtools-optimized-2.png" height="130px" width="600px"> |
| 67 | + |
| 68 | +{% markdownConvert %} |
| 69 | + |
| 70 | +In the **Size** column of the **Network** panel the trace shows that the product page was retrieved from the **prefetch cache** and now takes **3ms** to load: a **97% improvement** compared to the unoptimized version. |
| 71 | + |
| 72 | +Here is a comparison video: |
| 73 | + |
| 74 | +{% endmarkdownConvert %} |
| 75 | + |
| 76 | +<img loading="lazy" class="article-image" src="/assets/images/screenshots/wpt-video-comparison.gif" height="320px" width="450px"> |
| 77 | + |
| 78 | +{% markdownConvert %} |
| 79 | + |
| 80 | +### Single Page Apps |
| 81 | + |
| 82 | +Quicklink 2.0 includes support for React-based single-page-apps. This has been covered to the detail in this [guide](https://web.dev/quicklink/). |
| 83 | + |
| 84 | +To try the demo: |
| 85 | + |
| 86 | +1. Open the [optimized site](https://create-react-app-quicklink.glitch.me/) in Chrome. |
| 87 | +1. Open DevTools and go to the **Network** panel to simulate a **Fast 3G** Connection. |
| 88 | +1. Pick **Galaxy S5** as a simulated device. |
| 89 | +1. Make sure **Disable cache** is not checked. |
| 90 | +1. Reload the page. |
| 91 | + |
| 92 | +When the home page loads the chunks for that route are loaded. After that, `quicklink` prefetches the route's chunks for the in-viewport links: |
| 93 | + |
| 94 | +{% endmarkdownConvert %} |
| 95 | + |
| 96 | +<img loading="lazy" class="article-image" src="/assets/images/screenshots/spa-devtools-optimized-1.png" height="204px" width="570px"> |
| 97 | + |
| 98 | +Next: |
| 99 | + |
| 100 | +1. Clear the **Network** log again. |
| 101 | +1. Make sure **Disable** cache is not checked. |
| 102 | +1. Click the Blog link to navigate to that page. |
| 103 | + |
| 104 | +<img loading="lazy" class="article-image" src="/assets/images/screenshots/spa-devtools-optimized-2.png" height="76px" width="643px"> |
| 105 | + |
| 106 | +{% markdownConvert %} |
| 107 | + |
| 108 | +The Size column indicates that these chunks were retrieved from the "prefetch cache", instead of the network. Loading these chunks without a Quicklink takes approximately 580ms. Using the library it takes 2ms, which represents a 99% reduction! |
| 109 | + |
| 110 | +{% endmarkdownConvert %} |
26 | 111 | {% endblock %}
|
| 112 | + |
| 113 | + |
0 commit comments