Repository: GoogleChromeLabs/quicklink Branch: main Commit: 7b4198bb9dee Files: 119 Total size: 246.7 KB Directory structure: gitextract_udyormir/ ├── .babelrc.js ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── dependabot.yml │ └── workflows/ │ ├── ci.yml │ ├── codeql.yml │ ├── lint.yml │ ├── site.yml │ └── size-limit.yml ├── .gitignore ├── .size-limit.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── demos/ │ ├── basic.html │ ├── hrefFn/ │ │ ├── 2.html │ │ ├── 2.json │ │ └── hrefFn_demo.html │ ├── network-idle.html │ ├── network-idle.js │ ├── news/ │ │ └── README.md │ ├── news-workbox/ │ │ └── README.md │ ├── spa/ │ │ └── README.md │ └── sw.js ├── package.json ├── site/ │ ├── .browserslistrc │ ├── .config/ │ │ ├── configstore/ │ │ │ └── update-notifier-pnpm.json │ │ └── glitch-package-manager │ ├── .eleventy.js │ ├── .firebaserc │ ├── .gitignore │ ├── .stylelintignore │ ├── .stylelintrc.json │ ├── LICENSE │ ├── README.md │ ├── firebase.json │ ├── index.njk │ ├── package.json │ ├── src/ │ │ ├── _data/ │ │ │ └── site.js │ │ ├── _includes/ │ │ │ ├── components/ │ │ │ │ ├── chrome-extension.njk │ │ │ │ ├── copy-snippet.njk │ │ │ │ ├── download.njk │ │ │ │ ├── github-fork.njk │ │ │ │ ├── github-star.njk │ │ │ │ ├── heading.njk │ │ │ │ ├── installation.njk │ │ │ │ ├── over-prefetching.njk │ │ │ │ ├── react.njk │ │ │ │ ├── trusted-by.njk │ │ │ │ ├── usage.njk │ │ │ │ ├── use-with.njk │ │ │ │ ├── why-prefetch.njk │ │ │ │ └── why-quicklink.njk │ │ │ └── layouts/ │ │ │ ├── base.njk │ │ │ ├── favicons.njk │ │ │ ├── footer.njk │ │ │ ├── head.njk │ │ │ ├── header.njk │ │ │ ├── highlighted-section-wrapper.njk │ │ │ ├── normal-section-wrapper.njk │ │ │ └── social.njk │ │ ├── api.njk │ │ ├── approach.njk │ │ ├── assets/ │ │ │ ├── js/ │ │ │ │ └── script.js │ │ │ └── styles/ │ │ │ ├── _copy-snippet.scss │ │ │ ├── github-markdown.scss │ │ │ ├── main.scss │ │ │ └── vendor/ │ │ │ ├── _github-markdown.scss │ │ │ └── _prism.scss │ │ ├── demo.njk │ │ ├── index.njk │ │ ├── measure.njk │ │ ├── robots.njk │ │ ├── site.webmanifest │ │ └── sitemap.njk │ └── watch.json ├── src/ │ ├── chunks.mjs │ ├── index.mjs │ ├── prefetch.mjs │ ├── prerender.mjs │ ├── react-chunks.js │ └── request-idle-callback.mjs ├── test/ │ ├── fixtures/ │ │ ├── 1.html │ │ ├── 2.html │ │ ├── 3.html │ │ ├── 4.html │ │ ├── index.html │ │ ├── main.css │ │ ├── rmanifest.json │ │ ├── test-allow-origin-all.html │ │ ├── test-allow-origin.html │ │ ├── test-basic-usage.html │ │ ├── test-custom-dom-source.html │ │ ├── test-custom-href-function.html │ │ ├── test-delay.html │ │ ├── test-es-modules.html │ │ ├── test-ignore-basic.html │ │ ├── test-ignore-multiple.html │ │ ├── test-limit.html │ │ ├── test-node-list.html │ │ ├── test-prefetch-chunks.html │ │ ├── test-prefetch-duplicate-shared.html │ │ ├── test-prefetch-duplicate.html │ │ ├── test-prefetch-multiple.html │ │ ├── test-prefetch-single.html │ │ ├── test-prerender-andPrefetch.html │ │ ├── test-prerender-only.html │ │ ├── test-prerender-wrapper-multiple.html │ │ ├── test-prerender-wrapper-single.html │ │ ├── test-same-origin.html │ │ ├── test-threshold.html │ │ └── test-throttle.html │ └── quicklink.spec.js └── translations/ └── zh-cn/ └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc.js ================================================ 'use strict'; module.exports = { presets: [ '@babel/preset-react', [ '@babel/preset-env', { loose: true, bugfixes: true, }, ], ], }; ================================================ FILE: .editorconfig ================================================ # https://editorconfig.org/ root = true [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false ================================================ FILE: .eslintignore ================================================ **/*.min.js **/dist/ **/build/ **/vendor/ # explicitly include dot js files !.*.js ================================================ FILE: .eslintrc.js ================================================ 'use strict'; module.exports = { env: { browser: true, es6: true, node: true, }, parserOptions: { sourceType: 'script', ecmaVersion: 2017, }, extends: [ 'google', 'plugin:react/recommended', ], settings: { react: { version: 'detect', }, }, rules: { 'max-len': [ 'warn', { // 130 on GitHub, 80 on npmjs.org for README.md code blocks code: 130, }, ], 'arrow-parens': [ 'error', 'as-needed', ], 'space-before-function-paren': [ 'error', { anonymous: 'always', named: 'never', }, ], 'no-negated-condition': 'warn', 'no-const-assign': 'error', 'prefer-destructuring': [ 'off', { object: true, array: false, }, ], 'prefer-template': 'error', 'strict': 'error', 'spaced-comment': [ 'error', 'always', { exceptions: [ '/', ], }, ], }, overrides: [ { files: [ 'src/**', ], parserOptions: { sourceType: 'module', }, }, { files: [ 'site/**', ], env: { node: false, }, parserOptions: { sourceType: 'script', }, rules: { 'require-jsdoc': 'off', 'strict': 'error', }, }, ], }; ================================================ FILE: .gitattributes ================================================ # Enforce Unix newlines * text=auto eol=lf *.njk linguist-language=js ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Something is not working as expected labels: --- **Before you start** Please take a look at the [FAQ](https://github.com/GoogleChromeLabs/quicklink/wiki/FAQ) as well as the already opened issues! If nothing fits your problem, go ahead and fill out the following template: **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior. **Expected behavior** A clear and concise description of what you expected to happen. **Version:** * OS w/ version: [e.g. iOS 12] * Browser w/ version [e.g. Chrome 75] **Additional context, screenshots, screencasts** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project labels: --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: monthly groups: github-actions: patterns: - "*" ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: push: branches: - main pull_request: workflow_dispatch: env: FORCE_COLOR: 2 NODE: 24 permissions: contents: read jobs: run: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ env.NODE }} cache: npm - name: Disable AppArmor run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns - name: Install dependencies run: npm ci - name: Run tests run: npm test ================================================ FILE: .github/workflows/codeql.yml ================================================ name: "CodeQL" on: push: branches: - main pull_request: branches: - main schedule: - cron: "0 0 * * 0" workflow_dispatch: jobs: analyze: name: Analyze runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Initialize CodeQL uses: github/codeql-action/init@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 with: languages: "javascript" queries: +security-and-quality - name: Autobuild uses: github/codeql-action/autobuild@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6 with: category: "/language:javascript" ================================================ FILE: .github/workflows/lint.yml ================================================ name: Lint on: push: branches: - main pull_request: workflow_dispatch: env: FORCE_COLOR: 2 NODE: 24 permissions: contents: read jobs: lint: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: "${{ env.NODE }}" cache: npm - name: Install dependencies run: npm ci - name: Lint run: npm run lint ================================================ FILE: .github/workflows/site.yml ================================================ name: Site on: push: branches: - main pull_request: workflow_dispatch: env: FORCE_COLOR: 2 NODE: 24 permissions: contents: read defaults: run: working-directory: site jobs: build: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ env.NODE }} cache: npm - name: Install dependencies run: npm ci - name: Run tests run: npm test ================================================ FILE: .github/workflows/size-limit.yml ================================================ name: Size limit on: push: branches: - main pull_request: workflow_dispatch: env: FORCE_COLOR: 2 NODE: 24 permissions: contents: read jobs: size-limit: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Set up Node.js uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ env.NODE }} cache: npm - name: Install dependencies run: npm ci - name: Build run: npm run build - name: Run size-limit run: npm run size ================================================ FILE: .gitignore ================================================ # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* dist build .DS_Store # Runtime data pids *.pid *.seed *.pid.lock # Coverage directory used by tools like istanbul coverage # Dependency directories node_modules/ # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variables file .env # Local Netlify folder .netlify ================================================ FILE: .size-limit.json ================================================ [ { "path": "dist/quicklink.js", "limit": "2.5 kB", "gzip": true }, { "path": "dist/quicklink.mjs", "limit": "2.5 kB", "gzip": true }, { "path": "dist/quicklink.modern.mjs", "limit": "2 kB", "gzip": true }, { "path": "dist/quicklink.umd.js", "limit": "2.55 kB", "gzip": true } ] ================================================ FILE: CHANGELOG.md ================================================ ## 2.3.0 (2022-08-05) * 2.3.0 ([6189deb](https://github.com/GoogleChromeLabs/quicklink/commit/6189deb)) * Add support for same-site prerendering with Speculation Rules API (#258) ([3d26f40](https://github.com/GoogleChromeLabs/quicklink/commit/3d26f40)), closes [#258](https://github.com/GoogleChromeLabs/quicklink/issues/258) * Create node.js.yml ([2f69b42](https://github.com/GoogleChromeLabs/quicklink/commit/2f69b42)) * Fix Markdown (#250) ([13e2f82](https://github.com/GoogleChromeLabs/quicklink/commit/13e2f82)), closes [#250](https://github.com/GoogleChromeLabs/quicklink/issues/250) * Update node.js.yml ([312dbbb](https://github.com/GoogleChromeLabs/quicklink/commit/312dbbb)) * chore: Modify repository default languages (#264) ([5a0d396](https://github.com/GoogleChromeLabs/quicklink/commit/5a0d396)), closes [#264](https://github.com/GoogleChromeLabs/quicklink/issues/264) ## 2.2.0 (2021-06-18) * [release] additions to changelog ([6ac410c](https://github.com/GoogleChromeLabs/quicklink/commit/6ac410c)) * [release] bump core to 2.2.0 ([418eb50](https://github.com/GoogleChromeLabs/quicklink/commit/418eb50)) * [release] bump site to 2.2.0 ([22a055c](https://github.com/GoogleChromeLabs/quicklink/commit/22a055c)) * [release] update changelog for 2.2.0 ([bb1a648](https://github.com/GoogleChromeLabs/quicklink/commit/bb1a648)) * [site] reorder logos ([09907bb](https://github.com/GoogleChromeLabs/quicklink/commit/09907bb)) * [site] update version ([7babbda](https://github.com/GoogleChromeLabs/quicklink/commit/7babbda)) * Add Magento Quicklink module (Readme + Site) (#216) ([c77e057](https://github.com/GoogleChromeLabs/quicklink/commit/c77e057)), closes [#216](https://github.com/GoogleChromeLabs/quicklink/issues/216) * Added `threshold` option to allow users select the % of link areas that entered the viewport before ([d3746e1](https://github.com/GoogleChromeLabs/quicklink/commit/d3746e1)), closes [#214](https://github.com/GoogleChromeLabs/quicklink/issues/214) * Instructions to debug Quicklink ([2b3dc21](https://github.com/GoogleChromeLabs/quicklink/commit/2b3dc21)) ## 2.1.0 (2021-02-07) * [docs] Add React SPA demos to repo and site (#179) ([179cb56](https://github.com/GoogleChromeLabs/quicklink/commit/179cb56)), closes [#179](https://github.com/GoogleChromeLabs/quicklink/issues/179) * [docs] drop highlightjs reference and link up prism styles ([b91872b](https://github.com/GoogleChromeLabs/quicklink/commit/b91872b)) * [docs] Fix quicklink logo ([25829de](https://github.com/GoogleChromeLabs/quicklink/commit/25829de)) * [docs] minor tweak to header text ([cd31382](https://github.com/GoogleChromeLabs/quicklink/commit/cd31382)) * [docs] refactor api docs syntax highlighting ([59f7eca](https://github.com/GoogleChromeLabs/quicklink/commit/59f7eca)) * [docs] refactor copy-snippets syntax highlighting ([5445a8b](https://github.com/GoogleChromeLabs/quicklink/commit/5445a8b)) * [docs] refactor measure docs syntax highlighting ([eaa87ac](https://github.com/GoogleChromeLabs/quicklink/commit/eaa87ac)) * [docs] refactor over-prefetching docs syntax highlighting ([6ec1287](https://github.com/GoogleChromeLabs/quicklink/commit/6ec1287)) * [docs] refactor react docs syntax highlighting ([ba5984d](https://github.com/GoogleChromeLabs/quicklink/commit/ba5984d)) * [docs] refactor usage docs syntax highlighting ([25367f4](https://github.com/GoogleChromeLabs/quicklink/commit/25367f4)) * [docs] remainder of syntax highlighting fixes ([cf32a85](https://github.com/GoogleChromeLabs/quicklink/commit/cf32a85)) * [docs] remove highlightjs ([7ff8c8f](https://github.com/GoogleChromeLabs/quicklink/commit/7ff8c8f)) * [docs] Update CHANGELOG ([c4a4726](https://github.com/GoogleChromeLabs/quicklink/commit/c4a4726)) * [docs] various style theme improvements ([06786fb](https://github.com/GoogleChromeLabs/quicklink/commit/06786fb)) * [feat] (options): Add a `hrefFn` option to build the URL to prefetch. (#201) ([ee072d4](https://github.com/GoogleChromeLabs/quicklink/commit/ee072d4)), closes [#201](https://github.com/GoogleChromeLabs/quicklink/issues/201) * [feat] `delay` option to reduce impact on CDNs and servers [alternative without data-attributes] (#2 ([5cdf569](https://github.com/GoogleChromeLabs/quicklink/commit/5cdf569)), closes [#217](https://github.com/GoogleChromeLabs/quicklink/issues/217) * [infra] add eleventy syntax highlighting ([b48f80d](https://github.com/GoogleChromeLabs/quicklink/commit/b48f80d)) * [infra] Add site to firebase hosting config ([fe43486](https://github.com/GoogleChromeLabs/quicklink/commit/fe43486)) * [infra] bump version to 2.1.0 ([81232e8](https://github.com/GoogleChromeLabs/quicklink/commit/81232e8)) * Added Ray-Ban and Oakley from Luxxotica to trustedByLogos section (#202) ([b4494b0](https://github.com/GoogleChromeLabs/quicklink/commit/b4494b0)), closes [#202](https://github.com/GoogleChromeLabs/quicklink/issues/202) * Correct typo, duplicate "passing" (#185) ([932f655](https://github.com/GoogleChromeLabs/quicklink/commit/932f655)), closes [#185](https://github.com/GoogleChromeLabs/quicklink/issues/185) * Fix issues typo in 'network-idle.js' (#218) ([534e7b3](https://github.com/GoogleChromeLabs/quicklink/commit/534e7b3)), closes [#218](https://github.com/GoogleChromeLabs/quicklink/issues/218) * New demo page (#205) ([5205d62](https://github.com/GoogleChromeLabs/quicklink/commit/5205d62)), closes [#205](https://github.com/GoogleChromeLabs/quicklink/issues/205) * update homepage url in package.json (#184) ([172275b](https://github.com/GoogleChromeLabs/quicklink/commit/172275b)), closes [#184](https://github.com/GoogleChromeLabs/quicklink/issues/184) * Updating broken link ([224df77](https://github.com/GoogleChromeLabs/quicklink/commit/224df77)) * Fix: Cannot read property 'then' of undefined (#188) ([a8872b8](https://github.com/GoogleChromeLabs/quicklink/commit/a8872b8)), closes [#188](https://github.com/GoogleChromeLabs/quicklink/issues/188) * chore(deps): bump http-proxy from 1.18.0 to 1.18.1 (#200) ([0aa5157](https://github.com/GoogleChromeLabs/quicklink/commit/0aa5157)), closes [#200](https://github.com/GoogleChromeLabs/quicklink/issues/200) ## 2.0.0 (2020-05-07) * [infra] Add site updates for 2.0.0 (#178) ([8aa512b](https://github.com/GoogleChromeLabs/quicklink/commit/8aa512b)), closes [#178](https://github.com/GoogleChromeLabs/quicklink/issues/178) * [infra] Bump versions to 2.0.0 ([08d9a39](https://github.com/GoogleChromeLabs/quicklink/commit/08d9a39)) * 2.0.0 ([735caf6](https://github.com/GoogleChromeLabs/quicklink/commit/735caf6)) ## 2.0.0-beta (2020-04-24) * [core] Adds withQuicklink HOC (#172) ([89cd6a9](https://github.com/GoogleChromeLabs/quicklink/commit/89cd6a9)), closes [#172](https://github.com/GoogleChromeLabs/quicklink/issues/172) [#175](https://github.com/GoogleChromeLabs/quicklink/issues/175) [#176](https://github.com/GoogleChromeLabs/quicklink/issues/176) [#177](https://github.com/GoogleChromeLabs/quicklink/issues/177) * [core] Introduce prefetch chunks build (#171) ([301aedb](https://github.com/GoogleChromeLabs/quicklink/commit/301aedb)), closes [#171](https://github.com/GoogleChromeLabs/quicklink/issues/171) [#168](https://github.com/GoogleChromeLabs/quicklink/issues/168) [#169](https://github.com/GoogleChromeLabs/quicklink/issues/169) * [docs] Add initial site ([e934a2b](https://github.com/GoogleChromeLabs/quicklink/commit/e934a2b)) * [docs] Add notes on double-keyed caching ([03d3c97](https://github.com/GoogleChromeLabs/quicklink/commit/03d3c97)) * [docs] Added Newegg to trustedByLogos section (#153) ([453a661](https://github.com/GoogleChromeLabs/quicklink/commit/453a661)), closes [#153](https://github.com/GoogleChromeLabs/quicklink/issues/153) * [docs] Bugfix/syntax highlighting site (#147) ([0f644e7](https://github.com/GoogleChromeLabs/quicklink/commit/0f644e7)), closes [#147](https://github.com/GoogleChromeLabs/quicklink/issues/147) * [docs] Compress site resources w/ImageOptim ([179e18e](https://github.com/GoogleChromeLabs/quicklink/commit/179e18e)) * [docs] Measuring impact of QuickLink in sites guide (#146) ([2ce99e3](https://github.com/GoogleChromeLabs/quicklink/commit/2ce99e3)), closes [#146](https://github.com/GoogleChromeLabs/quicklink/issues/146) * [docs] New section "Quicklink extension" for home page. (#150) ([468c231](https://github.com/GoogleChromeLabs/quicklink/commit/468c231)), closes [#150](https://github.com/GoogleChromeLabs/quicklink/issues/150) * [docs] Over-prefetching section for home page (#148) ([75aa643](https://github.com/GoogleChromeLabs/quicklink/commit/75aa643)), closes [#148](https://github.com/GoogleChromeLabs/quicklink/issues/148) * [docs] Update the Angular logo (#158) ([836f170](https://github.com/GoogleChromeLabs/quicklink/commit/836f170)), closes [#158](https://github.com/GoogleChromeLabs/quicklink/issues/158) * [infra] Add firebase deployment ([89ab866](https://github.com/GoogleChromeLabs/quicklink/commit/89ab866)) * [infra] Fix tests (#142) ([6644860](https://github.com/GoogleChromeLabs/quicklink/commit/6644860)), closes [#142](https://github.com/GoogleChromeLabs/quicklink/issues/142) * [infra] Publish dist directory (#98) ([9cdf06f](https://github.com/GoogleChromeLabs/quicklink/commit/9cdf06f)), closes [#98](https://github.com/GoogleChromeLabs/quicklink/issues/98) * 2.0.0-beta ([185d1e8](https://github.com/GoogleChromeLabs/quicklink/commit/185d1e8)) * Add support for Quicklink 2.0.0-alpha ([7c7c917](https://github.com/GoogleChromeLabs/quicklink/commit/7c7c917)) * Add twitter metadata ([74d3224](https://github.com/GoogleChromeLabs/quicklink/commit/74d3224)) * Adding SPA section to README.md ([ea3229a](https://github.com/GoogleChromeLabs/quicklink/commit/ea3229a)) * Fix typo on README (#127) ([5acb27e](https://github.com/GoogleChromeLabs/quicklink/commit/5acb27e)), closes [#127](https://github.com/GoogleChromeLabs/quicklink/issues/127) * package.json: bump version to 2.0.0-alpha ([d5d5ca5](https://github.com/GoogleChromeLabs/quicklink/commit/d5d5ca5)) * Updates to initial site (#144) ([3f796f6](https://github.com/GoogleChromeLabs/quicklink/commit/3f796f6)), closes [#144](https://github.com/GoogleChromeLabs/quicklink/issues/144) * chore(deps): bump acorn from 6.4.0 to 6.4.1 (#167) ([8b62949](https://github.com/GoogleChromeLabs/quicklink/commit/8b62949)), closes [#167](https://github.com/GoogleChromeLabs/quicklink/issues/167) ## 2.0.0-alpha (2019-09-25) * (docs) update to remove TODOs from README ([8cd1183](https://github.com/GoogleChromeLabs/quicklink/commit/8cd1183)) * Update docs with ad-related considerations (#122) ([7ac672f](https://github.com/GoogleChromeLabs/quicklink/commit/7ac672f)), closes [#122](https://github.com/GoogleChromeLabs/quicklink/issues/122) * Major: Rework exports; Add `throttle` and `limit` options (#120) ([4044de0](https://github.com/GoogleChromeLabs/quicklink/commit/4044de0)), closes [#120](https://github.com/GoogleChromeLabs/quicklink/issues/120) [#1](https://github.com/GoogleChromeLabs/quicklink/issues/1) ## 1.0.1 (2019-08-17) * (demo) Introduce new demos for basic + workbox usage ([9eb7fa0](https://github.com/GoogleChromeLabs/quicklink/commit/9eb7fa0)) * (demos) Add new demos to README ([85729aa](https://github.com/GoogleChromeLabs/quicklink/commit/85729aa)) * (docs) Update README: note on session stitching ([ba9795c](https://github.com/GoogleChromeLabs/quicklink/commit/ba9795c)) * (infra) Bump version to 1.0.1 ([d75188d](https://github.com/GoogleChromeLabs/quicklink/commit/d75188d)) * A few quick size optimizations ([201c217](https://github.com/GoogleChromeLabs/quicklink/commit/201c217)) * Add homepage and bugs links to package.json (#116) ([002645b](https://github.com/GoogleChromeLabs/quicklink/commit/002645b)), closes [#116](https://github.com/GoogleChromeLabs/quicklink/issues/116) * Add note to README about Drupal module. ([d94ff80](https://github.com/GoogleChromeLabs/quicklink/commit/d94ff80)) * Check if `requestIdleCallback` exists in `window` (#112) ([089da91](https://github.com/GoogleChromeLabs/quicklink/commit/089da91)), closes [#112](https://github.com/GoogleChromeLabs/quicklink/issues/112) * Create .editorconfig (#61) ([beae09b](https://github.com/GoogleChromeLabs/quicklink/commit/beae09b)), closes [#61](https://github.com/GoogleChromeLabs/quicklink/issues/61) * Fail silently, don’t throw an error, when IntersectionObserver isn’t available (#113) ([32e5b61](https://github.com/GoogleChromeLabs/quicklink/commit/32e5b61)), closes [#113](https://github.com/GoogleChromeLabs/quicklink/issues/113) * Fix ES Module import syntax ([a2b90ff](https://github.com/GoogleChromeLabs/quicklink/commit/a2b90ff)) * GitHub Issue Templates (#109) ([2e6401e](https://github.com/GoogleChromeLabs/quicklink/commit/2e6401e)), closes [#109](https://github.com/GoogleChromeLabs/quicklink/issues/109) * HTML formatting tidy for Tests & Demos (#114) ([f4aef2e](https://github.com/GoogleChromeLabs/quicklink/commit/f4aef2e)), closes [#114](https://github.com/GoogleChromeLabs/quicklink/issues/114) * HTTPS link to gruntjs.com (#100) ([47f49e7](https://github.com/GoogleChromeLabs/quicklink/commit/47f49e7)), closes [#100](https://github.com/GoogleChromeLabs/quicklink/issues/100) * HTTPS link to nodejs.org (#110) ([cf9551e](https://github.com/GoogleChromeLabs/quicklink/commit/cf9551e)), closes [#110](https://github.com/GoogleChromeLabs/quicklink/issues/110) * Mention instant.page as a related project ([0bc8aec](https://github.com/GoogleChromeLabs/quicklink/commit/0bc8aec)) * Mention Safari ≥ 12.1 working without polyfills (#111) ([b01e5bb](https://github.com/GoogleChromeLabs/quicklink/commit/b01e5bb)), closes [#111](https://github.com/GoogleChromeLabs/quicklink/issues/111) * remove extraneous full stops / periods from comment (#105) ([23737af](https://github.com/GoogleChromeLabs/quicklink/commit/23737af)), closes [#105](https://github.com/GoogleChromeLabs/quicklink/issues/105) * remove unneeded type="text/css" from demo (#106) ([4dc74f1](https://github.com/GoogleChromeLabs/quicklink/commit/4dc74f1)), closes [#106](https://github.com/GoogleChromeLabs/quicklink/issues/106) * remove unneeded type="text/css" from demo page (#104) ([24919bd](https://github.com/GoogleChromeLabs/quicklink/commit/24919bd)), closes [#104](https://github.com/GoogleChromeLabs/quicklink/issues/104) * Update link to Gatsby with Guess.js (#108) ([dc02d33](https://github.com/GoogleChromeLabs/quicklink/commit/dc02d33)), closes [#108](https://github.com/GoogleChromeLabs/quicklink/issues/108) * Update microbundle to fix "missing JSX plugin" issue ([8f5cf22](https://github.com/GoogleChromeLabs/quicklink/commit/8f5cf22)) * Update repo path in package.json ([45e9bbd](https://github.com/GoogleChromeLabs/quicklink/commit/45e9bbd)) * Update the Readme and add a mention of the WordPress plugin ([0f15f45](https://github.com/GoogleChromeLabs/quicklink/commit/0f15f45)) * Use latest version of polyfill.io JS (#92) ([b15c8ba](https://github.com/GoogleChromeLabs/quicklink/commit/b15c8ba)), closes [#92](https://github.com/GoogleChromeLabs/quicklink/issues/92) * fix: Attempt to address build issues (Travis) ([9755280](https://github.com/GoogleChromeLabs/quicklink/commit/9755280)) * fix: stop observing links once prefetched; ([ce0011c](https://github.com/GoogleChromeLabs/quicklink/commit/ce0011c)) * fix(README): use UMD file for ` ``` 2. Add the following snippet in its place, to import the module from its source file: ```js ``` 3. Open [src/index.mjs](src/index.mjs) for edit and replace the following line: ```js import throttle from 'throttles'; ``` By: ```js import throttle from '../node_modules/throttles/dist/index.mjs' ``` 4. Build the project: `npm run build`. 5. Start a local server: `npm start`. By default, this will start the local server at `https://localhost:8080`. 6. Open the file where the modifications where made: `http://localhost:8080/test/fixtures/test-basic-usage.html`. 7. Open Chrome DevTools and go the **Sources** tab. 8. Under `localhost:8080/src` you can find the unminified versions of the `Quicklink` files. Now you can use breakpoints and inspect variables to debug the library. ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================
# quicklink > Faster subsequent page-loads by prefetching or prerendering in-viewport links during idle time ## How it works Quicklink attempts to make navigations to subsequent pages load faster. It: - **Detects links within the viewport** (using [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)) - **Waits until the browser is idle** (using [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback)) - **Checks if the user isn't on a slow connection** (using `navigator.connection.effectiveType`) or has data-saver enabled (using `navigator.connection.saveData`) - **Prefetches** (using [``](https://www.w3.org/TR/resource-hints/#prefetch) or XHR) or **prerenders** (using [Speculation Rules API](https://github.com/WICG/nav-speculation/blob/main/triggers.md)) URLs to the links. Provides some control over the request priority (can switch to `fetch()` if supported). ## Why This project aims to be a drop-in solution for sites to prefetch or prerender links based on what is in the user's viewport. It also aims to be small (**< 2KB minified/gzipped**). ## Multi page apps ### Installation For use with [Node.js](https://nodejs.org/) and [npm](https://www.npmjs.com/): ```sh npm install quicklink ``` You can also grab `quicklink` from [unpkg.com/quicklink](https://unpkg.com/quicklink). ### Usage Once initialized, `quicklink` will automatically prefetch URLs for links that are in-viewport during idle time. Quickstart: ```html ``` For example, you can initialize after the `load` event fires: ```html ``` ES Module import: ```js import {listen, prefetch} from 'quicklink'; ``` ## Single page apps (React) ### Installation First, install the packages with [Node.js](https://nodejs.org/) and [npm](https://www.npmjs.com/): ```sh npm install quicklink webpack-route-manifest --save-dev ``` Then, configure Webpack route manifest into your project, as explained [here](https://github.com/lukeed/webpack-route-manifest). This will generate a map of routes and chunks called `rmanifest.json`. It can be obtained at: - URL: `site_url/rmanifest.json` - Window object: `window.__rmanifest` ### Usage Import `quicklink` React HOC where want to add prefetching functionality. Wrap your routes with the `withQuicklink()` HOC. Example: ```jsx import {withQuicklink} from 'quicklink/dist/react/hoc.js'; const options = { origins: [], };Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta est sint assumenda corrupti minima aut, magnam totam beatae ullam ea iste voluptatum iusto expedita animi rem vitae rerum atque nemo!
================================================ FILE: demos/hrefFn/2.json ================================================ { "title": "API Target to Prefetch Example", "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta est sint assumenda corrupti minima aut, magnam totam beatae ullam ea iste voluptatum iusto expedita animi rem vitae rerum atque nemo!" } ================================================ FILE: demos/hrefFn/hrefFn_demo.html ================================================Link 1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
This demo uses network-idle-callback to only prefetch when network activity goes idle in the current tab.
Link 1 Link 2 Link 3
{% markdownConvert %}
To try the demo:
1. Open the [unoptimized site](https://mini-ecomm.glitch.me/) in Chrome.
1. Open **DevTools** and go to the **Network panel** to simulate a **Fast 3G** Connection.
1. Pick **Galaxy S5** as a simulated device.
1. Make sure **Disable cache** is not checked.
1. Reload the page.
{% endmarkdownConvert %}
{% markdownConvert %}
Now, measure performance on the same site, that uses Quicklink:
1. Open the [optimized site](https://mini-ecomm-quicklink.glitch.me/) in Chrome.
1. Open **DevTools** and go to the **Network panel** to simulate a **Fast 3G** Connection.
1. Pick **Galaxy S5** as a simulated device.
1. Make sure **Disable cache** is not checked.
1. Reload the page.
Prefetched links can be identified in the **Network** panel by having `quicklink` as the **Initiator** and **Lowest** as the **Priority**:
{% endmarkdownConvert %}
{% markdownConvert %}
To measure the impact of `quicklink` on navigations:
1. Clear the **Network** trace.
1. Click on a list item.
1. Take a look at the **Network** panel.
{% endmarkdownConvert %}
{% markdownConvert %}
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.
Here is a comparison video:
{% endmarkdownConvert %}
{% markdownConvert %}
### Single Page Apps
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/).
To try the demo:
1. Open the [optimized site](https://create-react-app-quicklink.glitch.me/) in Chrome.
1. Open DevTools and go to the **Network** panel to simulate a **Fast 3G** Connection.
1. Pick **Galaxy S5** as a simulated device.
1. Make sure **Disable cache** is not checked.
1. Reload the page.
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:
{% endmarkdownConvert %}
{% markdownConvert %}
Next:
1. Clear the **Network** log again.
1. Make sure **Disable** cache is not checked.
1. Click the Blog link to navigate to that page.
{% endmarkdownConvert %}
{% markdownConvert %}
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!
{% endmarkdownConvert %}
{% endblock %}
================================================
FILE: site/src/index.njk
================================================
---
title: Home
layout: layouts/base.njk
description: Faster subsequent page-loads by prefetching in-viewport links during idle time.
eleventyNavigation:
key: Home
order: 0
extra_head:
---
{% include "components/heading.njk" %}
{% include "components/why-quicklink.njk" %}
{% include "components/copy-snippet.njk" %}
{% include "components/download.njk" %}
{% include "components/trusted-by.njk" %}
{% include "components/installation.njk" %}
{% include "components/usage.njk" %}
{% include "components/over-prefetching.njk" %}
{% include "components/react.njk" %}
{% include "components/chrome-extension.njk" %}
{% include "components/why-prefetch.njk" %}
{% include "components/use-with.njk" %}
================================================
FILE: site/src/measure.njk
================================================
---
title: Measure
layout: layouts/base.njk
description: Faster subsequent page-loads by prefetching in-viewport links during idle time.
eleventyNavigation:
key: Measure
order: 4
---
{% extends "layouts/normal-section-wrapper.njk" %}
{% block section %}
{% markdownConvert %}
## Measuring impact of Quicklink in sites
Implementing Quicklink in sites can speed up navigations, by automatically prefetching in-viewport links during idle time.
Different metrics can be improved as a result of this, the most common ones being [Start Render](https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/quick-start-quide#TOC-Start-Render:) and [First Contentful Paint](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).
In this section, we explore different ways of measuring the impact of Quicklink in sites. To showcase that, we’ll use the following sites:
- An [unoptimized e-commerce demo](https://mini-ecomm.glitch.me/), consisting of a listing and a product page. The demo introduces a 1s delay before the product page response, to similate the backend processing time of a real e-commerce site. You can see the code, and make changes by remixing the [Glitch project](https://glitch.com/edit/#!/mini-ecomm?path=server.js:11:58).
- An [optimized version of the site](https://mini-ecomm-quicklink.glitch.me/), which is a copy of the original version, but this time, using Quicklink in the listing page, to prefetch links that come to the view. You can view and edit the code, in the [Glitch project](https://glitch.com/edit/#!/mini-ecomm-quicklink?path=server.js:1:0).
If you take a look at the code of the listing page, in the optimized version of the site, you'll find the code to initialize Quicklink:
{% endmarkdownConvert %}
{% highlight "js" %}
{% endhighlight %}
{% markdownConvert %}
## Using Chrome DevTools
The first tool you’ll use is [Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools), which is useful both for local development, and also for production URLs.
First, measure performance before implementing Quicklink:
- Open the [unoptimized demo](https://mini-ecomm.glitch.me/) in Chrome.
- Open the **Network** panel and simulate a **Fast 3G** Connection.
- Pick **Galaxy S5** as simulated device.
- Make sure **Disable cache** is not checked.
- Reload the page.
- Click on the first product in the listing.
Take a look at the **Time** column: the product page takes approximately **2.5s** to load:
{% endmarkdownConvert %}
{% markdownConvert %}
Now, measure performance after implementing Quicklink:
- Open the [optimized demo](https://mini-ecomm-quicklink.glitch.me/) in Chrome.
- Open the **Network** panel and simulate a Fast 3G Connection.
- Pick **Galaxy S5** as simulated device.
- Make sure **Disable cache** is not checked.
- Reload the page.
Prefetched links can be identified in the Network panel by having Quicklink as the **Initiator** and **Lowest** as the Priority:
{% endmarkdownConvert %}
{% markdownConvert %}
To measure the impact of Quicklink on navigations:
- Click on a list item.
- Take a look at the **Network** panel.
{% endmarkdownConvert %}
{% markdownConvert %}
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.
## Using Webpagetest
Webpagetest can be used to measure impact on real devices and different connection types. You'll use [WPT Scripting](https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/scripting) to simulate a user arriving at the home page and clicking one of the product items.
Open to webpagetest.org.
Pick **Nexus 5** as Test Location.
In the Advanced Settings tab, pick **3GFast** in the connection type.
In the Script tab, place the following script:
```
logData 0
navigate https://mini-ecomm.glitch.me/
logData 1
execAndWait document.querySelector('a').click()
```
The script instructs WPT to open the [unoptimized demo](https://mini-ecomm.glitch.me/) and simulate a click on the first product of the listing. Metrics are captured only for the product page. Here is the [resultiing test](https://www.webpagetest.org/result/191103_TM_e68d81788d8744762301b44c6e3e72d2/).
Repeat the process on [the demo](https://mini-ecomm-quicklink.glitch.me/) that uses Quicklink. The script looks like:
```
logData 0
navigate https://mini-ecomm.glitch.me/
logData 1
execAndWait document.querySelector('a').click()
```
Here is the [resultiing test](https://www.webpagetest.org/result/191103_E3_f8217e45ad837ac084868d4f3b9a4a73/).
The following table compares the main metrics obtained for each of the sites:
{% endmarkdownConvert %}
{% markdownConvert %}
Next, create a comparison between the tests.
- Open the [WPT test](https://www.webpagetest.org/result/191103_TM_e68d81788d8744762301b44c6e3e72d2/) for the unoptimized site.
- Click on the median run, that appears in the "First View" cell of the report.
- Repeat the same process in the [optimized test](https://www.webpagetest.org/result/191103_E3_f8217e45ad837ac084868d4f3b9a4a73/).
To create a comparison test, you need to append the IDs from the previous links as comma separated valuees, and send them as query params to `https://www.webpagetest.org/video/compare.php`:
```
https://www.webpagetest.org/video/compare.php?tests=test_id_1,test_id_2
```
The resulting comparison of the test ran previously can be found [here](https://www.webpagetest.org/video/compare.php?tests=191103_TM_e68d81788d8744762301b44c6e3e72d2-r%3A8-c%3A0%2C191103_E3_f8217e45ad837ac084868d4f3b9a4a73-r%3A7-c%3A0&thumbSize=200&ival=500&end=visual).
### Visual Comparison
The unoptimized site starts rendering approximately at **2.5s**, the demo that uses Quicklink, starts at **1.2s**.
{% endmarkdownConvert %}
{% markdownConvert %}
### Video
A video can be generated from the [comparison page](https://www.webpagetest.org/video/compare.php?tests=191103_TM_e68d81788d8744762301b44c6e3e72d2-r%3A8-c%3A0%2C191103_E3_f8217e45ad837ac084868d4f3b9a4a73-r%3A7-c%3A0&thumbSize=200&ival=500&end=visual), by clicking on **Create Video**.
{% endmarkdownConvert %}
{% markdownConvert %}
### Using RUM (Real user monitoring) tools
RUM tools, let you visualize how different metrics evolve in time for real users. If prefetching affects a large amount of pages, you might be able to see more page loads being loaded faster after implementing it, which can be reflected in metrics [First Contentful Paint](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).
For example, the [Chrome User Experience Report](https://developers.google.com/web/tools/chrome-user-experience-report/) provides performance metrics for how real-world Chrome users experience popular destinations on the web.
CrUX data is available in [PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights/) and also in [BigQuery](https://bigquery.cloud.google.com/dataset/chrome-ux-report:all?pli=1), but you can obtain a quick visualization of the evolution of your metrics using the [CrUX dashboard](https://g.co/chromeuxdash) (refer to [this guide](https://web.dev/chrome-ux-report-data-studio-dashboard/) for more details).
The report contains a section for First Contentful Paint. If a large number of page views are prefetched as a result of implementing Quicklink, this graph could show a positive evolution in time.
**Note:** Even when checking the performance for real users is a general performance best practice, it’s usually hard to correlate the overall performance improvement of a site with a single optimization like this one. With that said, the best way to make sure you’re measuring exactly this change is to perform a before / after test with laboratory tools as explained in previous sections.
### Using Quicklink Chrome extension
[Quicklink Chrome Extension](https://chrome.google.com/webstore/detail/quicklink-chrome-extensio/epmplkdcjhgigmnjmjibilpmekhgkbeg) injects Quicklink in every site a user visits. You can use it to measure the potential impact of implementing the library on a site, before doing it.
Since the extension will simulate how the library would work when implemented, you can install the extension and then run the tests with DevTools, as described in the previous section.
### Conclusion
Quicklink can highly improve navigations by automatically prefetching in-viewport links, . We’ve explored different tools to measure the impact of implementing it in your site.
Metrics like [Start Render](https://sites.google.com/a/webpagetest.org/docs/using-webpagetest/quick-start-quide#TOC-Start-Render:) and [First Contentful Paint](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint) can be directly impacted by this change, but other metrics can be also improved as a result of this, as seen in the tests performed in this guide.
Laboratory testing tools, like Chrome DevTools and Webpagetest can help you have an accurate idea of the impact of this change, by running a before / after comparison. Also, If the number of pages affected by this change is large enough, you might be able to visualize the impact of the implementation on real user monitoring (RUM) tools as well.
{% endmarkdownConvert %}
{% endblock %}
================================================
FILE: site/src/robots.njk
================================================
---
permalink: /robots.txt
layout: null
eleventyExcludeFromCollections: true
---
# www.robotstxt.org
User-agent: *
Disallow:{% if site.isNetlify %} /{% endif %}
Sitemap: {{ site.url + "/sitemap.xml" }}
================================================
FILE: site/src/site.webmanifest
================================================
{
"name": "Quicklink",
"short_name": "Quicklink",
"icons": [
{
"src": "/assets/images/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/images/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "/",
"theme_color": "#fff",
"background_color": "#fff",
"display": "standalone"
}
================================================
FILE: site/src/sitemap.njk
================================================
---
permalink: /sitemap.xml
layout: null
eleventyExcludeFromCollections: true
---
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta est sint assumenda corrupti minima aut, magnam totam beatae ullam ea iste voluptatum iusto expedita animi rem vitae rerum atque nemo!
================================================ FILE: test/fixtures/2.html ================================================Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta est sint assumenda corrupti minima aut, magnam totam beatae ullam ea iste voluptatum iusto expedita animi rem vitae rerum atque nemo!
================================================ FILE: test/fixtures/3.html ================================================Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta est sint assumenda corrupti minima aut, magnam totam beatae ullam ea iste voluptatum iusto expedita animi rem vitae rerum atque nemo!
================================================ FILE: test/fixtures/4.html ================================================Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta est sint assumenda corrupti minima aut, magnam totam beatae ullam ea iste voluptatum iusto expedita animi rem vitae rerum atque nemo!
================================================ FILE: test/fixtures/index.html ================================================