LH Jumpstart
Page prefetching with native speculation rules and a JS fallback for unsupported browsers
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/lhero-org/lh-jumpstart/archive/refs/heads/main.zipPrefetches pages before the user clicks, making navigation feel instant. On browsers that support the Speculation Rules API (Chrome, Edge), it configures native prerendering. On unsupported browsers (Firefox, Safari), it falls back to a JavaScript prefetch mechanism using <link rel="prefetch"> or fetch().
Installation
- Upload the
lh-jumpstartdirectory to/wp-content/plugins/ - Activate the plugin through the Plugins screen in WordPress
No configuration is required. The plugin works out of the box.
How it works
Chrome / Edge (Speculation Rules API)
On supporting browsers the plugin configures WordPress's built-in Speculation Rules output (introduced in WordPress 6.8) via the wp_speculation_rules_configuration filter. It sets mode: prerender and eagerness: eager, and applies the ignore lists as href_exclude rules so that excluded URLs are not prerendered.
Speculation rules are only output for logged-out users — WordPress automatically disables them for logged-in users, which prevents unnecessary server load.
Firefox / Safari (JS fallback)
On browsers that do not support the Speculation Rules API, a lightweight JavaScript fallback is activated. It prefetches pages using three triggers:
- Viewport — links visible in the viewport are queued for prefetch on page load and as the user scrolls
- Hover — links the user mouses over are added to a high-priority queue
- Touch — links the user touches on mobile are added to a high-priority queue
- Dialog open — when a
<dialog>element opens, visible links inside it are scanned and queued
Prefetch requests are rate-limited to maxRPS requests per 2-second interval (default: 3). Hover and touch triggered URLs are placed in a priority queue and dispatched before viewport-queued URLs, but still respect the rate limit.
The fallback uses <link rel="prefetch"> where supported, falling back to fetch().
Constants
This plugin defines no constants.
Admin interfaces
This plugin has no admin interface.
Database tables
This plugin creates no database tables.
Cron jobs
This plugin registers no cron jobs.
Hooks
Filters
lh_jumpstart_return_ignore_exact_urls
Filters the list of URLs that are excluded from prefetching by exact match. A URL in this list will only be excluded if it matches the full URL exactly.
add_filter( 'lh_jumpstart_return_ignore_exact_urls', function( $urls ) {
$urls[] = home_url( '/my-exact-page/' );
return $urls;
} );
Default: empty array.
lh_jumpstart_return_ignore_prefix_urls
Filters the list of URL prefixes that are excluded from prefetching. Any URL that begins with a value in this list will be excluded.
add_filter( 'lh_jumpstart_return_ignore_prefix_urls', function( $urls ) {
$urls[] = home_url( '/members/' );
$urls[] = home_url( '/activity/' );
return $urls;
} );
Default: admin_url().
Both ignore lists are applied to both the Speculation Rules exclude list (Chrome/Edge) and the JavaScript fallback (Firefox/Safari), so behaviour is consistent across browsers.
JavaScript configuration
The JS fallback reads configuration from window.FPConfig before the script initialises. You can override defaults by setting this variable before the script loads:
<script>
window.FPConfig = {
maxRPS: 2, // Maximum prefetch requests per 2-second interval (default: 3)
delay: 0, // Reserved for future use
};
</script>
Opt-out attribute
Add data-no-prefetch to any anchor element to prevent it from being prefetched by the JS fallback:
<a href="/do-not-prefetch/" data-no-prefetch>Link</a>
Note: the data-no-prefetch attribute applies to the JS fallback only. To exclude a URL from speculation rules on Chrome/Edge, use the lh_jumpstart_return_ignore_exact_urls or lh_jumpstart_return_ignore_prefix_urls filters.
Changelog
v1.0.7 — 2026-06-02
- Pre-populate prefetched Set from existing
<link rel="prefetch">tags in the DOM to prevent duplicate requests from other plugins - Renamed plugin from LH Flying Pages to LH Jumpstart
v1.0.6 — 2026-06-02
- Added
data-no-prefetchopt-out attribute for individual anchor elements
v1.0.5 — 2026-06-02
- Removed console.log calls from production JS
- Removed empty readme.txt
v1.0.4 — 2026-06-02
- Replaced IntersectionObserver with viewport scan using getBoundingClientRect
- Added debounced scroll listener to rescan viewport on scroll
- Added dialog toggle listener to scan links inside dialogs when they open
- Removed requestIdleCallback polyfill
- Removed unused hoverDelay option
v1.0.3 — 2026-06-02
- Added priority queue for hover and touch triggered prefetches
- Hover and touch URLs now respect maxRPS rate limit
v1.0.2 — 2026-06-02
- Apply ignore lists to Speculation Rules href_exclude so Chrome/Edge respects the same exclusions as the JS fallback
- Replaced DOM query in already_prefetched with a Set for performance
v1.0.1 — 2026-06-02
- Split ignore list into exact and prefix variants with separate filters
- Fixed querySelectorAll being called with multiple arguments
- Removed empty stop_prefetching function
- Removed unused ignoreKeywords option
- Removed orphaned contains_any_substrings function
- Replaced setInterval with one that clears itself when queue is empty
- Cached ignore URL lists at boot time instead of re-parsing on every check
- Removed add_scripts wrapper method
- Removed closing PHP tag
- Fixed speculation rules filter returning null instead of config
v1.0.0 — original
- Initial release (forked from Flying Pages)