Fix fragment navigation for gistpreview.github.io URLs (#13)
> The gistpreview mechanis has a bug: fragment links like https://gistpreview.github.io/?edbd5ddcb39d1edc9e175f1bf7b9ef9a/page-001.html#msg-2025-12-26T15-30-45-910Z do not naught the user to the right point, presumably because the content has not loaded in time > > Fix that with more JavaScript in the existing gistpreview JavaScript When accessing a gistpreview URL with a fragment (e.g. #msg-2025-12-26T15-30-45-910Z), the browser's native fragment navigation fails because gistpreview loads content dynamically. By the time the browser tries to scroll to the element, it doesn't exist yet. Added JavaScript that: - Checks for fragment in window.location.hash - Uses scrollIntoView to navigate to the target element - Retries with increasing delays (100ms, 300ms, 500ms, 1s) to handle dynamic content loading https://gistpreview.github.io/?883ee001b0d63a2045f1e2c7c2598a9f/index.html
S
Simon Willison committed
68f739501c209b16ea693a33e2dcb955e5bf1da3
Parent: 5b65cbc
Committed by GitHub <noreply@github.com>
on 12/27/2025, 12:54:18 AM