Skip to main content
KadiCache
Browse 37 Docs Guides & Search

Instant Links, Hover/Touch Prefetch & WooCommerce Safety

Deliver near-0ms page transitions with 100ms hover/touch prefetching, 3-request rate throttling, CSP-aware script delivery, and automatic cart/checkout/logout exclusions.

Optimization/InstantLinks.phpOptimization/CspPolicy.phpCache/Policy/PathRules.phpIntegrations/Plugins/PrivateCommerceRoutes.php
WP Admin -> KadiCache -> Preload & Warmup
MODULE 11 · 2X RETINA
Adaptive Sitemap Preload queue with decoded Unicode/Arabic URLs, Speculation Rules Instant Links, and Resource Hints.2880×1840 WebP
Quick Summary · 30-Second Operational SpecSource-Verified Guide
WP Admin Path
WP Admin -> KadiCache -> Preload (Instant Links)
Expected Outcome
100 ms Hover Trigger · Max 3 In-Flight · 100% Cart-Safe
Key Marker / Engine
script#kadicache-instant-links | onHoverDelay: 100
  • Prefetches same-origin public HTML links when an anonymous visitor hovers (onHoverDelay = 100 ms) or starts touching a link on mobile, capped at rateThrottle = 3 concurrent prefetches (InstantLinks.php).
  • Automatically disables itself for logged-in users, non-GET requests, plain (?p=123) permalinks, and sites requiring pre-selection cookies (CookieIntegrations::required()).
  • Merges all private commerce, wishlist, account, logout, affiliate, and binary file exclusions automatically (PrivateCommerceRoutes::wooPaths(), EDD pages, YITH Wishlist, excludedSegments, and 48 non-HTML file extensions).
  • Inspects active Content-Security-Policy headers via CspPolicy.php (InstantLinks::finalize()), falling back from inline #kadicache-instant-links to external defer instant-links.js automatically when inline scripts are restricted.

Even when Early PHP Drop-In Delivery serves HTML in 14 milliseconds on your server, a visitor on a mobile cellular network still experiences 80 ms to 220 ms of physical radio round-trip latency between tapping a product card and receiving the response bytes.

Human interaction research shows a reliable 120 ms to 300 ms gap between the moment a desktop user’s cursor settles over a link (or a mobile user’s finger touches touchstart) and the moment the click navigation commits. Instant Links (InstantLinks.php) uses that exact window to prefetch the destination HTML document into browser memory before the click finishes—so when the click fires, the next page paints in near 0 ms perceived wait time, making standard server-rendered WordPress feel as snappy as a client-side Single Page Application (SPA) without rewriting your theme!

FIG 01Coordinating WooCommerce cart safety alongside Instant Links and front-end speed optimizationsZoom 2x

Inside InstantLinks.php: Built-In Safety Rules That Prevent Accidental Side Effects#

Naive link-prefetch scripts are dangerous on WordPress and WooCommerce sites: prefetching ?add-to-cart=99 adds unwanted items to a shopper’s cart on hover; prefetching /customer-logout/ signs users out; prefetching /go/affiliate-partner/ inflates affiliate click counters; and prefetching a 60 MB .zip manual wastes mobile data!

InstantLinks.php eliminates every one of those hazards automatically through six layered safety filters:

Safety Layer in InstantLinks.phpExact Built-In ProtectionWhy It Matters
1. Anonymous & Pretty-Permalink GateRuns strictly for logged-out GET visits (!is_user_logged_in() & permalink_structure present)Never prefetches admin links, draft previews, or logged-in account actions
2. WooCommerce, EDD & Wishlist Auto-MergeMerges PrivateCommerceRoutes::wooPaths(), EDD purchase/cart/history pages & YITH_WCWL wishlist URLsHovering Cart, Checkout, My Account, or Wishlist buttons never triggers private PHP requests
3. Protected Path Segments (excludedSegments)Blocks wp-login.php, wp-admin, wp-json, xmlrpc.php, wp-cron.php, customer-logout, logout, signout, out, go, refer, recommend, recommendsProtects auth endpoints, REST APIs, and /go/ or /out/ affiliate cloaking redirects!
4. 48 Non-HTML File Extensions (fileExtensions)Skips .pdf, .zip, .mp4, .mp3, .jpg, .png, .webp, .docx, .xlsx, .csv, .dmg, .exe, etc.Never wastes visitor bandwidth prefetching downloadable documents, media, or archives
5. Global & Per-Page Exclusions SyncAutomatically inherits excluded_paths, instant_links_exclusions, and Gutenberg never_cache (PostSettings::hintPaths())Exclude a route once in Cache or Gutenberg and Instant Links respects it automatically
6. Hover Debounce & Rate ThrottleonHoverDelay: 100 ms + rateThrottle: 3 max concurrent prefetchesSweeping a mouse rapidly across a 40-link mega-menu never floods your server

Automatic Content-Security-Policy (CSP) Adaptation & Delay-JS Independence#

Two subtle engineering touches in InstantLinks.php make it resilient across enterprise security setups and aggressive script optimization:

  1. Immune to Delay JS & Minify Collisions (InstantLinks::printScript()): KadiCache tags #kadicache-instant-links with data-kadicache-no-delay, data-kadicache-no-defer, data-no-minify, and data-kadicache-independent so even when Delay Until Interaction (Delay JS Guide) is active, link prefetching works immediately on first hover.
  2. Smart CspPolicy Inline-to-External Fallback (InstantLinks::finalize()): Before sending HTML, InstantLinks::finalize() checks active Content-Security-Policy headers and <meta http-equiv="Content-Security-Policy"> tags via CspPolicy.php. If inline <script> execution is permitted (or matched by nonce/hash), it keeps the zero-request inline snippet; if strict script-src 'self' blocks inline scripts, it automatically rewrites #kadicache-instant-links to <script src=".../instant-links.js" defer> so zero CSP console errors ever fire!
HTMLInspecting Active Instant Links Configuration in Guest HTML Source
<!-- Printed near </body> for anonymous guests only -->
<script id="kadicache-instant-links"
        data-kadicache-links='{"excludedPaths":["/cart*","/checkout*","/my-account*"],"excludedSegments":["wp-login.php","wp-admin","wp-json","customer-logout","logout","signout","out","go","refer","recommend","recommends"],"onHoverDelay":100,"rateThrottle":3}'
        data-kadicache-no-delay
        data-kadicache-independent>/* minified instant-links runtime */</script>

If your site uses a custom affiliate redirect prefix (such as /partner/* or /deal/*) or a dynamic state-changing GET link outside standard /out/ and /go/ conventions, open WP Admin -> KadiCache -> Preload, expand Instant Links Exclusions (instant_links_exclusions), and add /partner/* (one path or prefix wildcard per line).

  • Respecting WooCommerce Dynamic Stock & Flash-Sale Pages: If you run a limited-drop flash sale page (/limited-drop/) where inventory sells out every few seconds, either mark that page Never cache this page in Gutenberg or add /limited-drop/* to Instant Links Exclusions so browsers fetch live stock state at click time.
  • Zero Extra Network Weight (< 1.8 KB Minified): InstantLinks.php caches its minified JavaScript payload in static memory (self::$minifiedCache), adding less than 1.8 KB (under 900 bytes gzipped) to guest HTML responses while keeping main-thread parsing cost under 1 millisecond on mobile phones.
  • Skips target="_blank", download & In-Page #hash Anchors Automatically: External tabs, mailto:/tel: links, HTML5 download attributes, and same-page Table of Contents #anchor jumps are ignored natively so browser memory is reserved strictly for real internal page transitions.
  • Zero False Pageviews in Google Analytics 4 (GA4) & Plausible: Modern analytics scripts (gtag.js, Plausible, Fathom, Matomo, and KadiCache’s own Cookieless RUM) fire pageview beacons when a document becomes visible/activated, not during background HTML link prefetching—so enabling Instant Links never inflates your bounce rate or pageview counts.
  • Synergy With Cloudflare & Browser Revalidation: When a visitor hovers over a product card for 100 ms, the prefetch request warms both any upstream CDN edge PoP (Cloudflare, CDN & Varnish) and the browser’s in-memory prefetch cache—delivering instant visual transitions across desktop mice and mobile touchscreens alike.

Frequently Asked Operational Questions

Can Instant Links accidentally add items to a WooCommerce cart or log a customer out on hover?
Never. InstantLinks.php excludes all query-action links (?add-to-cart=...), merges WooCommerce Cart/Checkout/Account paths automatically, blocks logout/signout segments, and runs strictly for logged-out anonymous GET visitors.
Will hovering over /go/ or /out/ affiliate links trigger false affiliate clicks?
No! InstantLinks.php includes out, go, refer, recommend, and recommends in its built-in excludedSegments list out of the box, and lets you add custom prefixes like /deal/* in Instant Links Exclusions.
Does Instant Links work on Safari and Firefox as well as Chrome and Edge?
Yes. KadiCache’s lightweight hover/touch prefetch runtime works across Chrome, Edge, Safari (macOS & iOS touchstart), and Firefox.
Will Instant Links overload my server if a user waves their mouse across a mega-menu?
No. InstantLinks enforces both a 100 ms hover intent debounce (ignoring rapid cursor fly-overs) and a strict rateThrottle of 3 concurrent requests—and because pages are warmed by Sitemap Preload, prefetches hit 0-SQL Early Cache snapshots.
Does Instant Links respect Data-Saver mode and strict Content-Security-Policy headers?
Yes. Save-Data / slow-connection browser hints are respected, and InstantLinks::finalize() inspects active CSP headers via CspPolicy.php so strict script-src policies never break or throw console errors.
Gergis — Lead Systems & Cache Architect
Principal WordPress & Cloud Edge Architect
E-E-A-T Source Verified

Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.

apps/wordpress-plugin/src/Optimization/InstantLinks.phpapps/wordpress-plugin/src/Optimization/CspPolicy.phpapps/wordpress-plugin/src/Cache/Policy/PathRules.phpapps/wordpress-plugin/src/Integrations/Plugins/PrivateCommerceRoutes.php
Was this engineering guide helpful?