
內容簡介
Quicklink for WordPress 可嘗試加快導航到下一個頁面的加載速度。該插件嵌入了一個 JavaScript 库,用於檢測視口中的連結,等待瀏覽器閒置並預取這些連結的 URL。該庫還嘗試檢測用戶的連接速度或數據計劃是否較慢。
該插件在Google Chrome Labs的優秀工作基礎上進行了延伸。
有關Quicklink的更多信息,請查看官方網站。
工作原理
檢測視口內的連結(使用Intersection Observer)
等待瀏覽器閒置(使用requestIdleCallback)
檢查用戶是否未使用較慢的連接(使用navigator.connection.effectiveType)或已啟用數據節省模式(使用navigator.connection.saveData)
預取連結的 URL(使用<link rel=prefetch>或 XHR)。可以對請求優先級進行控制(如支持,可以切換到fetch())。
如果您是開發人員,我們建議您關注或在GitHub上參與該插件的開發。
外掛標籤
開發者團隊
原文外掛簡介
Quicklink for WordPress attempts to make navigation to subsequent pages load faster. Embedded with the plugin is a javascript library, which detects links in the viewport, waits until the browser is idle and prefetches the URLs for these links. The library also tries to detect, if the user is on a slow connection or on a data plan.
This plugin builds heavily on the amazing work done by Google Chrome Labs.
More information about Quicklink on the official Website.
How it works
Detects links within the viewport (using Intersection Observer)
Waits until the browser is idle (using 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 URLs to the links (using or XHR). Provides some control over the request priority (can switch to fetch() if supported).
If you are a developer, we encourage you to follow along or contribute to the development of this plugin on GitHub.
