5f8ffd1c

By: Michael Lynch <git@mtlynch.io>

Prefetch adjacent images via JS to fix Firefox CSP compatibility

<link rel="prefetch"> CSP behaviour varies by browser: Chrome 112+ uses
the type-based img-src directive (so it worked), while Firefox falls back
to default-src, which only allows 'self' and therefore blocked cross-origin
S3/CDN prefetch requests. prefetch-src is not implemented in Firefox, so
adding that directive to the CSP has no effect there.

Replace the <link rel="prefetch"> tags with new Image() calls in JS.
Image() loads are governed by img-src in all browsers, which already
includes the media origin. The adjacent-image URLs are rendered as
data attributes on the content element (per the project convention of
not embedding Go template conditionals in JavaScript) and the JS reads
them after DOMContentLoaded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Suite timing

Time to Start Worker time Duration Time to finish
Config 3s 1s 1s 5s
Eval 5s 38s 38s 43s
Build 7s 5m13s 2m54s 3m01s
Test - - - -
Deploy - - - -
Suite 3s 5m53s 2m57s 3m01s

Timeline

0s20s40s1m1m20s1m40s2m2m20s2m40s3m